StringSet.Add() is called with series of cases for valid and erroneous inputs and the result is validated.
(t *testing.T)
| 51 | |
| 52 | // StringSet.Add() is called with series of cases for valid and erroneous inputs and the result is validated. |
| 53 | func TestStringSetAdd(t *testing.T) { |
| 54 | testCases := []struct { |
| 55 | value string |
| 56 | expectedResult string |
| 57 | }{ |
| 58 | // Test first addition. |
| 59 | {"foo", `[foo]`}, |
| 60 | // Test duplicate addition. |
| 61 | {"foo", `[foo]`}, |
| 62 | // Test new addition. |
| 63 | {"bar", `[bar foo]`}, |
| 64 | } |
| 65 | |
| 66 | ss := NewStringSet() |
| 67 | for _, testCase := range testCases { |
| 68 | ss.Add(testCase.value) |
| 69 | if str := ss.String(); str != testCase.expectedResult { |
| 70 | t.Fatalf("expected: %s, got: %s", testCase.expectedResult, str) |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | // StringSet.Remove() is called with series of cases for valid and erroneous inputs and the result is validated. |
| 76 | func TestStringSetRemove(t *testing.T) { |
nothing calls this directly
no test coverage detected