Skip to content

Commit

Permalink
Add NotEqual function to check package
Browse files Browse the repository at this point in the history
  • Loading branch information
richardwilkes committed Mar 22, 2024
1 parent 0794395 commit b399887
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ func Equal(t *testing.T, expected, actual any, msgAndArgs ...any) {
}
}

// NotEqual compares two values for inequality.
func NotEqual(t *testing.T, expected, actual any, msgAndArgs ...any) {
t.Helper()
if equal(expected, actual) {
errMsg(t, fmt.Sprintf("Expected %v to not be %v", expected, actual), msgAndArgs...)
}
}

func equal(expected, actual any) bool {
if expected == nil || actual == nil {
return expected == actual
Expand Down

0 comments on commit b399887

Please sign in to comment.