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

Function TestArray_InList

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

Source from the content-addressed store, hash-verified

669}
670
671func TestArray_InList(t *testing.T) {
672 t.Run("basic", func(t *testing.T) {
673 cases := []struct {
674 name string
675 value []interface{}
676 testList []interface{}
677 wantInList chainResult
678 }{
679 {
680 name: "one element list with equal array",
681 value: []interface{}{"foo", "bar"},
682 testList: []interface{}{
683 []interface{}{"foo", "bar"},
684 },
685 wantInList: success,
686 },
687 {
688 name: "one element list with inequal array",
689 value: []interface{}{"foo", "bar"},
690 testList: []interface{}{
691 []interface{}{"bar", "foo"},
692 },
693 wantInList: failure,
694 },
695 {
696 name: "list with inequal and equal arrays",
697 value: []interface{}{"foo", "bar"},
698 testList: []interface{}{
699 []interface{}{"bar", "foo"},
700 []interface{}{"foo", "bar"},
701 },
702 wantInList: success,
703 },
704 {
705 name: "list with inequal arrays",
706 value: []interface{}{"foo", "bar"},
707 testList: []interface{}{
708 []interface{}{"bar", "foo"},
709 []interface{}{"FOO", "BAR"},
710 },
711 wantInList: failure,
712 },
713 }
714
715 for _, tc := range cases {
716 t.Run(tc.name, func(t *testing.T) {
717 reporter := newMockReporter(t)
718
719 NewArray(reporter, tc.value).InList(tc.testList...).
720 chain.assert(t, tc.wantInList)
721
722 NewArray(reporter, tc.value).NotInList(tc.testList...).
723 chain.assert(t, !tc.wantInList)
724 })
725 }
726 })
727
728 t.Run("canonization", func(t *testing.T) {

Callers

nothing calls this directly

Calls 6

newMockReporterFunction · 0.85
NewArrayFunction · 0.85
assertMethod · 0.80
myIntTypeAlias · 0.70
InListMethod · 0.45
NotInListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…