MCPcopy
hub / github.com/cortexlabs/cortex / TestHasString

Function TestHasString

pkg/lib/slices/string_test.go:65–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

63}
64
65func TestHasString(t *testing.T) {
66 cases := []struct {
67 name string
68 slice []string
69 target string
70 expected bool
71 }{
72 {
73 name: "exists",
74 slice: []string{"a", "b", "c"},
75 target: "a",
76 expected: true,
77 },
78 {
79 name: "doesn't exist",
80 slice: []string{"a", "b", "c"},
81 target: "d",
82 expected: false,
83 },
84 {
85 name: "nil",
86 slice: nil,
87 target: "a",
88 expected: false,
89 },
90 }
91
92 for _, tt := range cases {
93 t.Run(tt.name, func(t *testing.T) {
94 result := slices.HasString(tt.slice, tt.target)
95 require.Equal(t, tt.expected, result)
96 })
97 }
98}
99
100func TestRemoveString(t *testing.T) {
101 cases := []struct {

Callers

nothing calls this directly

Calls 2

HasStringFunction · 0.92
EqualMethod · 0.80

Tested by

no test coverage detected