From b39988713f7b04594dcc53d7c46ecd55a56f25fa Mon Sep 17 00:00:00 2001 From: Richard Wilkes Date: Fri, 22 Mar 2024 16:55:26 -0700 Subject: [PATCH] Add NotEqual function to check package --- check/check.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/check/check.go b/check/check.go index e908f2a..52c8d7a 100644 --- a/check/check.go +++ b/check/check.go @@ -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