(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestSplitAndTrimEmpty(t *testing.T) { |
| 10 | testCases := []struct { |
| 11 | s string |
| 12 | sep string |
| 13 | cutset string |
| 14 | expected []string |
| 15 | }{ |
| 16 | {"a,b,c", ",", " ", []string{"a", "b", "c"}}, |
| 17 | {" a , b , c ", ",", " ", []string{"a", "b", "c"}}, |
| 18 | {" a, b, c ", ",", " ", []string{"a", "b", "c"}}, |
| 19 | {" a, ", ",", " ", []string{"a"}}, |
| 20 | {" ", ",", " ", []string{}}, |
| 21 | } |
| 22 | |
| 23 | for _, tc := range testCases { |
| 24 | require.Equal(t, tc.expected, SplitAndTrimEmpty(tc.s, tc.sep, tc.cutset), "%s", tc.s) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | func TestStringInSlice(t *testing.T) { |
| 29 | require.True(t, StringInSlice("a", []string{"a", "b", "c"})) |
nothing calls this directly
no test coverage detected
searching dependent graphs…