MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestArray_IsEqualUnordered

Function TestArray_IsEqualUnordered

array_test.go:526–669  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

524}
525
526func TestArray_IsEqualUnordered(t *testing.T) {
527 t.Run("without duplicates", func(t *testing.T) {
528 cases := []struct {
529 name string
530 value []interface{}
531 testValue interface{}
532 wantEqualUnordered chainResult
533 }{
534 {
535 name: "only first element",
536 value: []interface{}{123, "foo"},
537 testValue: []interface{}{123},
538 wantEqualUnordered: failure,
539 },
540 {
541 name: "only second element",
542 value: []interface{}{123, "foo"},
543 testValue: []interface{}{"foo"},
544 wantEqualUnordered: failure,
545 },
546 {
547 name: "extra element",
548 value: []interface{}{123, "foo"},
549 testValue: []interface{}{123, "foo", "foo"},
550 wantEqualUnordered: failure,
551 },
552 {
553 name: "equal ordered",
554 value: []interface{}{123, "foo"},
555 testValue: []interface{}{123, "foo"},
556 wantEqualUnordered: success,
557 },
558 {
559 name: "equal unordered",
560 value: []interface{}{123, "foo"},
561 testValue: []interface{}{"foo", 123},
562 wantEqualUnordered: success,
563 },
564 {
565 name: "overlap",
566 value: []interface{}{123, "foo"},
567 testValue: []interface{}{"foo", 1234},
568 wantEqualUnordered: failure,
569 },
570 }
571
572 for _, tc := range cases {
573 t.Run(tc.name, func(t *testing.T) {
574 reporter := newMockReporter(t)
575
576 NewArray(reporter, tc.value).IsEqualUnordered(tc.testValue).
577 chain.assert(t, tc.wantEqualUnordered)
578
579 NewArray(reporter, tc.value).NotEqualUnordered(tc.testValue).
580 chain.assert(t, !tc.wantEqualUnordered)
581 })
582 }
583 })

Callers

nothing calls this directly

Calls 6

newMockReporterFunction · 0.85
NewArrayFunction · 0.85
assertMethod · 0.80
IsEqualUnorderedMethod · 0.80
NotEqualUnorderedMethod · 0.80
myIntTypeAlias · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…