(t *testing.T)
| 928 | } |
| 929 | |
| 930 | func TestArray_Contains(t *testing.T) { |
| 931 | t.Run("basic", func(t *testing.T) { |
| 932 | cases := []struct { |
| 933 | name string |
| 934 | array []interface{} |
| 935 | value interface{} |
| 936 | wantContains chainResult |
| 937 | }{ |
| 938 | { |
| 939 | name: "first value in array", |
| 940 | array: []interface{}{123, "foo"}, |
| 941 | value: 123, |
| 942 | wantContains: success, |
| 943 | }, |
| 944 | { |
| 945 | name: "second value in array", |
| 946 | array: []interface{}{123, "foo"}, |
| 947 | value: "foo", |
| 948 | wantContains: success, |
| 949 | }, |
| 950 | { |
| 951 | name: "value not in array", |
| 952 | array: []interface{}{123, "foo"}, |
| 953 | value: "FOO", |
| 954 | wantContains: failure, |
| 955 | }, |
| 956 | { |
| 957 | name: "array", |
| 958 | array: []interface{}{123, "foo"}, |
| 959 | value: []interface{}{123, "foo"}, |
| 960 | wantContains: failure, |
| 961 | }, |
| 962 | } |
| 963 | |
| 964 | for _, tc := range cases { |
| 965 | t.Run(tc.name, func(t *testing.T) { |
| 966 | reporter := newMockReporter(t) |
| 967 | |
| 968 | NewArray(reporter, tc.array).Contains(tc.value). |
| 969 | chain.assert(t, tc.wantContains) |
| 970 | |
| 971 | NewArray(reporter, tc.array).NotContains(tc.value). |
| 972 | chain.assert(t, !tc.wantContains) |
| 973 | }) |
| 974 | } |
| 975 | }) |
| 976 | |
| 977 | t.Run("canonization", func(t *testing.T) { |
| 978 | type ( |
| 979 | myInt int |
| 980 | ) |
| 981 | cases := []struct { |
| 982 | name string |
| 983 | array []interface{} |
| 984 | value interface{} |
| 985 | wantContains chainResult |
| 986 | }{ |
| 987 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…