(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestTrackBadCommand(t *testing.T) { |
| 10 | tests := []struct { |
| 11 | name string |
| 12 | commands [][2]string |
| 13 | expected map[string]int |
| 14 | }{ |
| 15 | { |
| 16 | name: "single command", |
| 17 | commands: [][2]string{ |
| 18 | {"foo", "bar"}, |
| 19 | }, |
| 20 | expected: map[string]int{ |
| 21 | "foo bar": 1, |
| 22 | }, |
| 23 | }, |
| 24 | { |
| 25 | name: "multiple commands same cmd/rest", |
| 26 | commands: [][2]string{ |
| 27 | {"foo", "bar"}, |
| 28 | {"foo", "bar"}, |
| 29 | }, |
| 30 | expected: map[string]int{ |
| 31 | "foo bar": 2, |
| 32 | }, |
| 33 | }, |
| 34 | { |
| 35 | name: "multiple commands different rest", |
| 36 | commands: [][2]string{ |
| 37 | {"foo", "bar"}, |
| 38 | {"foo", "baz"}, |
| 39 | }, |
| 40 | expected: map[string]int{ |
| 41 | "foo bar": 1, |
| 42 | "foo baz": 1, |
| 43 | }, |
| 44 | }, |
| 45 | { |
| 46 | name: "multiple commands different cmd", |
| 47 | commands: [][2]string{ |
| 48 | {"foo", "bar"}, |
| 49 | {"baz", "qux"}, |
| 50 | }, |
| 51 | expected: map[string]int{ |
| 52 | "foo bar": 1, |
| 53 | "baz qux": 1, |
| 54 | }, |
| 55 | }, |
| 56 | { |
| 57 | name: "complex mix", |
| 58 | commands: [][2]string{ |
| 59 | {"foo", "bar"}, |
| 60 | {"foo", "bar"}, |
| 61 | {"foo", "baz"}, |
| 62 | {"baz", "qux"}, |
| 63 | {"baz", "qux"}, |
| 64 | {"baz", "qux"}, |
| 65 | }, |
| 66 | expected: map[string]int{ |
nothing calls this directly
no test coverage detected