(t *testing.T)
| 850 | } |
| 851 | |
| 852 | func TestArray_ConsistsOf(t *testing.T) { |
| 853 | t.Run("basic", func(t *testing.T) { |
| 854 | cases := []struct { |
| 855 | name string |
| 856 | array []interface{} |
| 857 | value []interface{} |
| 858 | wantConsistsOf chainResult |
| 859 | }{ |
| 860 | { |
| 861 | name: "first value (int) in array", |
| 862 | array: []interface{}{123, "foo"}, |
| 863 | value: []interface{}{123}, |
| 864 | wantConsistsOf: failure, |
| 865 | }, |
| 866 | { |
| 867 | name: "second value (string) in array", |
| 868 | array: []interface{}{123, "foo"}, |
| 869 | value: []interface{}{"foo"}, |
| 870 | wantConsistsOf: failure, |
| 871 | }, |
| 872 | { |
| 873 | name: "reversed order", |
| 874 | array: []interface{}{123, "foo"}, |
| 875 | value: []interface{}{"foo", 123}, |
| 876 | wantConsistsOf: failure, |
| 877 | }, |
| 878 | { |
| 879 | name: "duplicate element", |
| 880 | array: []interface{}{123, "foo"}, |
| 881 | value: []interface{}{"foo", "foo", 123}, |
| 882 | wantConsistsOf: failure, |
| 883 | }, |
| 884 | { |
| 885 | name: "copy of array", |
| 886 | array: []interface{}{123, "foo"}, |
| 887 | value: []interface{}{123, "foo"}, |
| 888 | wantConsistsOf: success, |
| 889 | }, |
| 890 | } |
| 891 | |
| 892 | for _, tc := range cases { |
| 893 | t.Run(tc.name, func(t *testing.T) { |
| 894 | reporter := newMockReporter(t) |
| 895 | |
| 896 | NewArray(reporter, tc.array).ConsistsOf(tc.value...). |
| 897 | chain.assert(t, tc.wantConsistsOf) |
| 898 | |
| 899 | NewArray(reporter, tc.array).NotConsistsOf(tc.value...). |
| 900 | chain.assert(t, !tc.wantConsistsOf) |
| 901 | }) |
| 902 | } |
| 903 | }) |
| 904 | |
| 905 | t.Run("canonization", func(t *testing.T) { |
| 906 | type ( |
| 907 | myInt int |
| 908 | ) |
| 909 |
nothing calls this directly
no test coverage detected
searching dependent graphs…