(t *testing.T)
| 1113 | } |
| 1114 | |
| 1115 | func TestArray_ContainsAny(t *testing.T) { |
| 1116 | t.Run("basic", func(t *testing.T) { |
| 1117 | cases := []struct { |
| 1118 | name string |
| 1119 | array []interface{} |
| 1120 | value []interface{} |
| 1121 | wantContainsAny chainResult |
| 1122 | }{ |
| 1123 | { |
| 1124 | name: "first element", |
| 1125 | array: []interface{}{123, "foo"}, |
| 1126 | value: []interface{}{123}, |
| 1127 | wantContainsAny: success, |
| 1128 | }, |
| 1129 | { |
| 1130 | name: "copy of array", |
| 1131 | array: []interface{}{123, "foo"}, |
| 1132 | value: []interface{}{"foo", 123}, |
| 1133 | wantContainsAny: success, |
| 1134 | }, |
| 1135 | { |
| 1136 | name: "double valid elements", |
| 1137 | array: []interface{}{123, "foo"}, |
| 1138 | value: []interface{}{"foo", "foo"}, |
| 1139 | wantContainsAny: success, |
| 1140 | }, |
| 1141 | { |
| 1142 | name: "array with one invalid element", |
| 1143 | array: []interface{}{123, "foo"}, |
| 1144 | value: []interface{}{123, "foo", "FOO"}, |
| 1145 | wantContainsAny: success, |
| 1146 | }, |
| 1147 | { |
| 1148 | name: "invalid element", |
| 1149 | array: []interface{}{123, "foo"}, |
| 1150 | value: []interface{}{"FOO"}, |
| 1151 | wantContainsAny: failure, |
| 1152 | }, |
| 1153 | { |
| 1154 | name: "subset of array", |
| 1155 | array: []interface{}{123, "foo", "bar"}, |
| 1156 | value: []interface{}{"bar", "foo"}, |
| 1157 | wantContainsAny: success, |
| 1158 | }, |
| 1159 | } |
| 1160 | for _, tc := range cases { |
| 1161 | t.Run(tc.name, func(t *testing.T) { |
| 1162 | reporter := newMockReporter(t) |
| 1163 | |
| 1164 | NewArray(reporter, tc.array).ContainsAny(tc.value...). |
| 1165 | chain.assert(t, tc.wantContainsAny) |
| 1166 | |
| 1167 | NewArray(reporter, tc.array).NotContainsAny(tc.value...). |
| 1168 | chain.assert(t, !tc.wantContainsAny) |
| 1169 | }) |
| 1170 | } |
| 1171 | |
| 1172 | }) |
nothing calls this directly
no test coverage detected
searching dependent graphs…