MCPcopy
hub / github.com/stretchr/testify / TestNotElementsMatch

Function TestNotElementsMatch

assert/assertions_test.go:1456–1502  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1454}
1455
1456func TestNotElementsMatch(t *testing.T) {
1457 t.Parallel()
1458
1459 mockT := new(testing.T)
1460
1461 cases := []struct {
1462 expected interface{}
1463 actual interface{}
1464 result bool
1465 }{
1466 // not matching
1467 {[]int{1}, []int{}, true},
1468 {[]int{}, []int{2}, true},
1469 {[]int{1}, []int{2}, true},
1470 {[]int{1}, []int{1, 1}, true},
1471 {[]int{1, 2}, []int{3, 4}, true},
1472 {[]int{3, 4}, []int{1, 2}, true},
1473 {[]int{1, 1, 2, 3}, []int{1, 2, 3}, true},
1474 {[]string{"hello"}, []string{"world"}, true},
1475 {[]string{"hello", "hello"}, []string{"world", "world"}, true},
1476 {[3]string{"hello", "hello", "hello"}, [3]string{"world", "world", "world"}, true},
1477
1478 // matching
1479 {nil, nil, false},
1480 {[]int{}, nil, false},
1481 {[]int{}, []int{}, false},
1482 {[]int{1}, []int{1}, false},
1483 {[]int{1, 1}, []int{1, 1}, false},
1484 {[]int{1, 2}, []int{2, 1}, false},
1485 {[2]int{1, 2}, [2]int{2, 1}, false},
1486 {[]int{1, 1, 2}, []int{1, 2, 1}, false},
1487 {[]string{"hello", "world"}, []string{"world", "hello"}, false},
1488 {[]string{"hello", "hello"}, []string{"hello", "hello"}, false},
1489 {[]string{"hello", "hello", "world"}, []string{"hello", "world", "hello"}, false},
1490 {[3]string{"hello", "hello", "world"}, [3]string{"hello", "world", "hello"}, false},
1491 }
1492
1493 for _, c := range cases {
1494 t.Run(fmt.Sprintf("NotElementsMatch(%#v, %#v)", c.expected, c.actual), func(t *testing.T) {
1495 res := NotElementsMatch(mockT, c.actual, c.expected)
1496
1497 if res != c.result {
1498 t.Errorf("NotElementsMatch(%#v, %#v) should return %v", c.actual, c.expected, c.result)
1499 }
1500 })
1501 }
1502}
1503
1504func TestCondition(t *testing.T) {
1505 t.Parallel()

Callers

nothing calls this directly

Calls 3

NotElementsMatchFunction · 0.70
ErrorfMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected