@@ -222,6 +222,10 @@ func TestEqual(t *testing.T) {
222222 if Equal (mockT , myType ("1" ), myType ("2" )) {
223223 t .Error ("Equal should return false" )
224224 }
225+ // A case that might be confusing, especially with numeric literals
226+ if Equal (mockT , 10 , uint (10 )) {
227+ t .Error ("Equal should return false" )
228+ }
225229}
226230
227231func ptr (i int ) * int {
@@ -544,6 +548,70 @@ func TestNotEqual(t *testing.T) {
544548 if NotEqual (mockT , & struct {}{}, & struct {}{}) {
545549 t .Error ("NotEqual should return false" )
546550 }
551+
552+ // A case that might be confusing, especially with numeric literals
553+ if ! NotEqual (mockT , 10 , uint (10 )) {
554+ t .Error ("NotEqual should return false" )
555+ }
556+ }
557+
558+ func TestNotEqualValues (t * testing.T ) {
559+
560+ mockT := new (testing.T )
561+
562+ // Same tests as NotEqual since they behave the same when types are irrelevant
563+ if ! NotEqualValues (mockT , "Hello World" , "Hello World!" ) {
564+ t .Error ("NotEqualValues should return true" )
565+ }
566+ if ! NotEqualValues (mockT , 123 , 1234 ) {
567+ t .Error ("NotEqualValues should return true" )
568+ }
569+ if ! NotEqualValues (mockT , 123.5 , 123.55 ) {
570+ t .Error ("NotEqualValues should return true" )
571+ }
572+ if ! NotEqualValues (mockT , []byte ("Hello World" ), []byte ("Hello World!" )) {
573+ t .Error ("NotEqualValues should return true" )
574+ }
575+ if ! NotEqualValues (mockT , nil , new (AssertionTesterConformingObject )) {
576+ t .Error ("NotEqualValues should return true" )
577+ }
578+ if NotEqualValues (mockT , nil , nil ) {
579+ t .Error ("NotEqualValues should return false" )
580+ }
581+ if NotEqualValues (mockT , "Hello World" , "Hello World" ) {
582+ t .Error ("NotEqualValues should return false" )
583+ }
584+ if NotEqualValues (mockT , 123 , 123 ) {
585+ t .Error ("NotEqualValues should return false" )
586+ }
587+ if NotEqualValues (mockT , 123.5 , 123.5 ) {
588+ t .Error ("NotEqualValues should return false" )
589+ }
590+ if NotEqualValues (mockT , []byte ("Hello World" ), []byte ("Hello World" )) {
591+ t .Error ("NotEqualValues should return false" )
592+ }
593+ if NotEqualValues (mockT , new (AssertionTesterConformingObject ), new (AssertionTesterConformingObject )) {
594+ t .Error ("NotEqualValues should return false" )
595+ }
596+ if NotEqualValues (mockT , & struct {}{}, & struct {}{}) {
597+ t .Error ("NotEqualValues should return false" )
598+ }
599+
600+ // Special cases where NotEqualValues behaves differently
601+ funcA := func () int { return 23 }
602+ funcB := func () int { return 42 }
603+ if ! NotEqualValues (mockT , funcA , funcB ) {
604+ t .Error ("NotEqualValues should return true" )
605+ }
606+ if ! NotEqualValues (mockT , int (10 ), int (11 )) {
607+ t .Error ("NotEqualValues should return true" )
608+ }
609+ if NotEqualValues (mockT , int (10 ), uint (10 )) {
610+ t .Error ("NotEqualValues should return false" )
611+ }
612+ if NotEqualValues (mockT , struct {}{}, struct {}{}) {
613+ t .Error ("NotEqualValues should return false" )
614+ }
547615}
548616
549617type A struct {
@@ -2139,6 +2207,7 @@ func TestComparisonAssertionFunc(t *testing.T) {
21392207 {"isType" , (* testing .T )(nil ), t , IsType },
21402208 {"equal" , t , t , Equal },
21412209 {"equalValues" , t , t , EqualValues },
2210+ {"notEqualValues" , t , nil , NotEqualValues },
21422211 {"exactly" , t , t , Exactly },
21432212 {"notEqual" , t , nil , NotEqual },
21442213 {"notContains" , []int {1 , 2 , 3 }, 4 , NotContains },
0 commit comments