| 833 | } |
| 834 | |
| 835 | func TestNotEqual(t *testing.T) { |
| 836 | |
| 837 | mockT := new(testing.T) |
| 838 | |
| 839 | cases := []struct { |
| 840 | expected interface{} |
| 841 | actual interface{} |
| 842 | result bool |
| 843 | }{ |
| 844 | // cases that are expected not to match |
| 845 | {"Hello World", "Hello World!", true}, |
| 846 | {123, 1234, true}, |
| 847 | {123.5, 123.55, true}, |
| 848 | {[]byte("Hello World"), []byte("Hello World!"), true}, |
| 849 | {nil, new(AssertionTesterConformingObject), true}, |
| 850 | |
| 851 | // cases that are expected to match |
| 852 | {nil, nil, false}, |
| 853 | {"Hello World", "Hello World", false}, |
| 854 | {123, 123, false}, |
| 855 | {123.5, 123.5, false}, |
| 856 | {[]byte("Hello World"), []byte("Hello World"), false}, |
| 857 | {new(AssertionTesterConformingObject), new(AssertionTesterConformingObject), false}, |
| 858 | {&struct{}{}, &struct{}{}, false}, |
| 859 | {func() int { return 23 }, func() int { return 24 }, false}, |
| 860 | // A case that might be confusing, especially with numeric literals |
| 861 | {int(10), uint(10), true}, |
| 862 | } |
| 863 | |
| 864 | for _, c := range cases { |
| 865 | t.Run(fmt.Sprintf("NotEqual(%#v, %#v)", c.expected, c.actual), func(t *testing.T) { |
| 866 | res := NotEqual(mockT, c.expected, c.actual) |
| 867 | |
| 868 | if res != c.result { |
| 869 | t.Errorf("NotEqual(%#v, %#v) should return %#v", c.expected, c.actual, c.result) |
| 870 | } |
| 871 | }) |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | func TestNotEqualValues(t *testing.T) { |
| 876 | mockT := new(testing.T) |