(t *testing.T)
| 211 | } |
| 212 | |
| 213 | func TestScopeTrackerUnmatched(t *testing.T) { |
| 214 | testCases := []struct { |
| 215 | name string |
| 216 | ri *RuntimeInputs |
| 217 | matched []string |
| 218 | want []string |
| 219 | }{ |
| 220 | { |
| 221 | name: "nil runtime inputs", |
| 222 | ri: nil, |
| 223 | want: nil, |
| 224 | }, |
| 225 | { |
| 226 | name: "all scopes matched", |
| 227 | ri: &RuntimeInputs{Scoped: map[string]map[string]string{"a": {}, "b": {}}}, |
| 228 | matched: []string{"a", "b"}, |
| 229 | want: nil, |
| 230 | }, |
| 231 | { |
| 232 | name: "unmatched scopes returned sorted", |
| 233 | ri: &RuntimeInputs{Scoped: map[string]map[string]string{"zebra": {}, "alpha": {}, "beta": {}}}, |
| 234 | matched: []string{"beta"}, |
| 235 | want: []string{"alpha", "zebra"}, |
| 236 | }, |
| 237 | } |
| 238 | |
| 239 | for _, tc := range testCases { |
| 240 | t.Run(tc.name, func(t *testing.T) { |
| 241 | tracker := newScopeTracker() |
| 242 | tracker.mark(tc.matched...) |
| 243 | assert.Equal(t, tc.want, tracker.unmatched(tc.ri)) |
| 244 | }) |
| 245 | } |
| 246 | } |
nothing calls this directly
no test coverage detected