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

Function TestRemoveString

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

Source from the content-addressed store, hash-verified

98}
99
100func TestRemoveString(t *testing.T) {
101 cases := []struct {
102 name string
103 slice []string
104 target string
105 expected []string
106 }{
107 {
108 name: "simple",
109 slice: []string{"a", "b", "c"},
110 target: "a",
111 expected: []string{"b", "c"},
112 },
113 {
114 name: "repeated",
115 slice: []string{"a", "b", "c", "c"},
116 target: "c",
117 expected: []string{"a", "b"},
118 },
119 {
120 name: "nil",
121 slice: nil,
122 target: "a",
123 expected: nil,
124 },
125 {
126 name: "unchanged",
127 slice: []string{"a", "b", "c", "c"},
128 target: "d",
129 expected: []string{"a", "b", "c", "c"},
130 },
131 }
132
133 for _, tt := range cases {
134 t.Run(tt.name, func(t *testing.T) {
135 result := slices.RemoveString(tt.slice, tt.target)
136 require.Equal(t, tt.expected, result)
137 })
138 }
139}

Callers

nothing calls this directly

Calls 2

RemoveStringFunction · 0.92
EqualMethod · 0.80

Tested by

no test coverage detected