(t *testing.T)
| 98 | } |
| 99 | |
| 100 | func 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 | } |
nothing calls this directly
no test coverage detected