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

Function TestArray_ContainsAll

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

Source from the content-addressed store, hash-verified

1023}
1024
1025func TestArray_ContainsAll(t *testing.T) {
1026 t.Run("basic", func(t *testing.T) {
1027 cases := []struct {
1028 name string
1029 array []interface{}
1030 value []interface{}
1031 wantContainsAll chainResult
1032 }{
1033 {
1034 name: "first element",
1035 array: []interface{}{123, "foo"},
1036 value: []interface{}{123},
1037 wantContainsAll: success,
1038 },
1039 {
1040 name: "second element",
1041 array: []interface{}{123, "foo"},
1042 value: []interface{}{"foo"},
1043 wantContainsAll: success,
1044 },
1045 {
1046 name: "element not in array",
1047 array: []interface{}{123, "foo"},
1048 value: []interface{}{"FOO"},
1049 wantContainsAll: failure,
1050 },
1051 {
1052 name: "array copy",
1053 array: []interface{}{123, "foo"},
1054 value: []interface{}{123, "foo"},
1055 wantContainsAll: success,
1056 },
1057 {
1058 name: "double valid elements",
1059 array: []interface{}{123, "foo"},
1060 value: []interface{}{"foo", "foo"},
1061 wantContainsAll: success,
1062 },
1063 {
1064 name: "array with one invalid element",
1065 array: []interface{}{123, "foo"},
1066 value: []interface{}{123, "foo", "FOO"},
1067 wantContainsAll: failure,
1068 },
1069 {
1070 name: "subset of array",
1071 array: []interface{}{123, "foo", "bar"},
1072 value: []interface{}{"bar", "foo"},
1073 wantContainsAll: success,
1074 },
1075 }
1076
1077 for _, tc := range cases {
1078 t.Run(tc.name, func(t *testing.T) {
1079 reporter := newMockReporter(t)
1080
1081 NewArray(reporter, tc.array).ContainsAll(tc.value...).
1082 chain.assert(t, tc.wantContainsAll)

Callers

nothing calls this directly

Calls 6

newMockReporterFunction · 0.85
NewArrayFunction · 0.85
assertMethod · 0.80
ContainsAllMethod · 0.80
NotContainsAllMethod · 0.80
myIntTypeAlias · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…