(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestUniqueStrings(t *testing.T) { |
| 14 | tests := []struct { |
| 15 | input []string |
| 16 | expected []string |
| 17 | }{ |
| 18 | { |
| 19 | []string{"a", "b"}, |
| 20 | []string{"a", "b"}, |
| 21 | }, |
| 22 | { |
| 23 | []string{"a", "a"}, |
| 24 | []string{"a"}, |
| 25 | }, |
| 26 | { |
| 27 | []string{"a", "a", "a", "a"}, |
| 28 | []string{"a"}, |
| 29 | }, |
| 30 | { |
| 31 | nil, |
| 32 | nil, |
| 33 | }, |
| 34 | { |
| 35 | []string{" a ", " a ", "b ", " b"}, |
| 36 | []string{"a", "b"}, |
| 37 | }, |
| 38 | } |
| 39 | |
| 40 | for _, test := range tests { |
| 41 | result := UniqueTrimmedStrings(test.input) |
| 42 | if len(result) != len(test.expected) { |
| 43 | t.Errorf("%s != %s", result, test.expected) |
| 44 | } |
| 45 | for i := range result { |
| 46 | if test.expected[i] != result[i] { |
| 47 | t.Errorf("%s != %s", result, test.expected) |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | } |
nothing calls this directly
no test coverage detected