(t *testing.T)
| 145 | } |
| 146 | |
| 147 | func TestRemoveRepeatedChar(t *testing.T) { |
| 148 | testCases := []struct { |
| 149 | name string |
| 150 | str string |
| 151 | char byte |
| 152 | want string |
| 153 | }{ |
| 154 | { |
| 155 | name: "empty", |
| 156 | str: "", |
| 157 | char: 'a', |
| 158 | want: "", |
| 159 | }, |
| 160 | { |
| 161 | name: "noSlash", |
| 162 | str: "abc", |
| 163 | char: ',', |
| 164 | want: "abc", |
| 165 | }, |
| 166 | { |
| 167 | name: "withSlash", |
| 168 | str: "/a/b/c/", |
| 169 | char: '/', |
| 170 | want: "/a/b/c/", |
| 171 | }, |
| 172 | { |
| 173 | name: "withRepeatedSlashes", |
| 174 | str: "/a//b///c////", |
| 175 | char: '/', |
| 176 | want: "/a/b/c/", |
| 177 | }, |
| 178 | { |
| 179 | name: "threeSlashes", |
| 180 | str: "///", |
| 181 | char: '/', |
| 182 | want: "/", |
| 183 | }, |
| 184 | } |
| 185 | |
| 186 | for _, tc := range testCases { |
| 187 | t.Run(tc.name, func(t *testing.T) { |
| 188 | res := removeRepeatedChar(tc.str, tc.char) |
| 189 | assert.Equal(t, tc.want, res) |
| 190 | }) |
| 191 | } |
| 192 | } |
nothing calls this directly
no test coverage detected