(t *testing.T)
| 113 | } |
| 114 | |
| 115 | func Test_parseTableList(t *testing.T) { |
| 116 | testData := []string{"foo", "b*", "bar", "back_up", "foo,bar,b*"} |
| 117 | patterns := parseTableList(testData) |
| 118 | actual := patterns.list() |
| 119 | expected := []string{"foo", "b*", "bar", "back_up"} |
| 120 | sort.Slice(actual, func(i, j int) bool { |
| 121 | return actual[i] > actual[j] |
| 122 | }) |
| 123 | sort.Slice(expected, func(i, j int) bool { |
| 124 | return expected[i] > expected[j] |
| 125 | }) |
| 126 | assert.Equal(t, strings.Join(expected, ","), strings.Join(actual, ",")) |
| 127 | |
| 128 | matchTestData := map[string]bool{ |
| 129 | "foo": true, |
| 130 | "bar": true, |
| 131 | "back_up": true, |
| 132 | "bit": true, |
| 133 | "ab": false, |
| 134 | "b": true, |
| 135 | } |
| 136 | for v, expected := range matchTestData { |
| 137 | actual := patterns.Match(v) |
| 138 | assert.Equal(t, expected, actual) |
| 139 | } |
| 140 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…