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

Function TestArray_ConsistsOf

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

Source from the content-addressed store, hash-verified

850}
851
852func TestArray_ConsistsOf(t *testing.T) {
853 t.Run("basic", func(t *testing.T) {
854 cases := []struct {
855 name string
856 array []interface{}
857 value []interface{}
858 wantConsistsOf chainResult
859 }{
860 {
861 name: "first value (int) in array",
862 array: []interface{}{123, "foo"},
863 value: []interface{}{123},
864 wantConsistsOf: failure,
865 },
866 {
867 name: "second value (string) in array",
868 array: []interface{}{123, "foo"},
869 value: []interface{}{"foo"},
870 wantConsistsOf: failure,
871 },
872 {
873 name: "reversed order",
874 array: []interface{}{123, "foo"},
875 value: []interface{}{"foo", 123},
876 wantConsistsOf: failure,
877 },
878 {
879 name: "duplicate element",
880 array: []interface{}{123, "foo"},
881 value: []interface{}{"foo", "foo", 123},
882 wantConsistsOf: failure,
883 },
884 {
885 name: "copy of array",
886 array: []interface{}{123, "foo"},
887 value: []interface{}{123, "foo"},
888 wantConsistsOf: success,
889 },
890 }
891
892 for _, tc := range cases {
893 t.Run(tc.name, func(t *testing.T) {
894 reporter := newMockReporter(t)
895
896 NewArray(reporter, tc.array).ConsistsOf(tc.value...).
897 chain.assert(t, tc.wantConsistsOf)
898
899 NewArray(reporter, tc.array).NotConsistsOf(tc.value...).
900 chain.assert(t, !tc.wantConsistsOf)
901 })
902 }
903 })
904
905 t.Run("canonization", func(t *testing.T) {
906 type (
907 myInt int
908 )
909

Callers

nothing calls this directly

Calls 6

newMockReporterFunction · 0.85
NewArrayFunction · 0.85
assertMethod · 0.80
ConsistsOfMethod · 0.80
NotConsistsOfMethod · 0.80
myIntTypeAlias · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…