NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, the number of appearances of each of them in both lists should not match. This is an inverse of ElementsMatch. ass
(t TestingT, listA, listB interface{}, msgAndArgs ...interface{})
| 1238 | // |
| 1239 | // assert.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true |
| 1240 | func NotElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) { |
| 1241 | if h, ok := t.(tHelper); ok { |
| 1242 | h.Helper() |
| 1243 | } |
| 1244 | if isEmpty(listA) && isEmpty(listB) { |
| 1245 | return Fail(t, "listA and listB contain the same elements", msgAndArgs) |
| 1246 | } |
| 1247 | |
| 1248 | if !isList(t, listA, msgAndArgs...) { |
| 1249 | return Fail(t, "listA is not a list type", msgAndArgs...) |
| 1250 | } |
| 1251 | if !isList(t, listB, msgAndArgs...) { |
| 1252 | return Fail(t, "listB is not a list type", msgAndArgs...) |
| 1253 | } |
| 1254 | |
| 1255 | extraA, extraB := diffLists(listA, listB) |
| 1256 | if len(extraA) == 0 && len(extraB) == 0 { |
| 1257 | return Fail(t, "listA and listB contain the same elements", msgAndArgs) |
| 1258 | } |
| 1259 | |
| 1260 | return true |
| 1261 | } |
| 1262 | |
| 1263 | // Condition uses a Comparison to assert a complex condition. |
| 1264 | func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { |