(t *testing.T)
| 1195 | } |
| 1196 | |
| 1197 | func TestElementsMatch(t *testing.T) { |
| 1198 | mockT := new(testing.T) |
| 1199 | |
| 1200 | cases := []struct { |
| 1201 | expected interface{} |
| 1202 | actual interface{} |
| 1203 | result bool |
| 1204 | }{ |
| 1205 | // matching |
| 1206 | {nil, nil, true}, |
| 1207 | |
| 1208 | {nil, nil, true}, |
| 1209 | {[]int{}, []int{}, true}, |
| 1210 | {[]int{1}, []int{1}, true}, |
| 1211 | {[]int{1, 1}, []int{1, 1}, true}, |
| 1212 | {[]int{1, 2}, []int{1, 2}, true}, |
| 1213 | {[]int{1, 2}, []int{2, 1}, true}, |
| 1214 | {[2]int{1, 2}, [2]int{2, 1}, true}, |
| 1215 | {[]string{"hello", "world"}, []string{"world", "hello"}, true}, |
| 1216 | {[]string{"hello", "hello"}, []string{"hello", "hello"}, true}, |
| 1217 | {[]string{"hello", "hello", "world"}, []string{"hello", "world", "hello"}, true}, |
| 1218 | {[3]string{"hello", "hello", "world"}, [3]string{"hello", "world", "hello"}, true}, |
| 1219 | {[]int{}, nil, true}, |
| 1220 | |
| 1221 | // not matching |
| 1222 | {[]int{1}, []int{1, 1}, false}, |
| 1223 | {[]int{1, 2}, []int{2, 2}, false}, |
| 1224 | {[]string{"hello", "hello"}, []string{"hello"}, false}, |
| 1225 | } |
| 1226 | |
| 1227 | for _, c := range cases { |
| 1228 | t.Run(fmt.Sprintf("ElementsMatch(%#v, %#v)", c.expected, c.actual), func(t *testing.T) { |
| 1229 | res := ElementsMatch(mockT, c.actual, c.expected) |
| 1230 | |
| 1231 | if res != c.result { |
| 1232 | t.Errorf("ElementsMatch(%#v, %#v) should return %v", c.actual, c.expected, c.result) |
| 1233 | } |
| 1234 | }) |
| 1235 | } |
| 1236 | } |
| 1237 | |
| 1238 | func TestDiffLists(t *testing.T) { |
| 1239 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…