(t *testing.T)
| 202 | } |
| 203 | |
| 204 | func TestSliceToReadableString(t *testing.T) { |
| 205 | tests := []struct { |
| 206 | name string |
| 207 | input []string |
| 208 | expected string |
| 209 | }{ |
| 210 | { |
| 211 | name: "no element", |
| 212 | input: []string{""}, |
| 213 | expected: "", |
| 214 | }, |
| 215 | { |
| 216 | name: "one element", |
| 217 | input: []string{"maguro"}, |
| 218 | expected: "maguro", |
| 219 | }, |
| 220 | { |
| 221 | name: "two element", |
| 222 | input: []string{"maguro", "otoro"}, |
| 223 | expected: "maguro and otoro", |
| 224 | }, |
| 225 | { |
| 226 | name: "three element", |
| 227 | input: []string{"maguro", "otoro", "tamago"}, |
| 228 | expected: "maguro, otoro and tamago", |
| 229 | }, |
| 230 | { |
| 231 | name: "five element", |
| 232 | input: []string{"one", "two", "three", "four", "five"}, |
| 233 | expected: "one, two, three, four and five", |
| 234 | }, |
| 235 | } |
| 236 | |
| 237 | for _, tt := range tests { |
| 238 | t.Run(tt.name, func(t *testing.T) { |
| 239 | assert.Equal(t, tt.expected, SliceToReadableString(tt.input)) |
| 240 | }) |
| 241 | } |
| 242 | } |
nothing calls this directly
no test coverage detected