(t *testing.T)
| 5 | ) |
| 6 | |
| 7 | func TestPosixParserGetKey(t *testing.T) { |
| 8 | scenarioTable := []struct { |
| 9 | name string |
| 10 | input []byte |
| 11 | expected Key |
| 12 | }{ |
| 13 | { |
| 14 | name: "escape", |
| 15 | input: []byte{0x1b}, |
| 16 | expected: Escape, |
| 17 | }, |
| 18 | { |
| 19 | name: "undefined", |
| 20 | input: []byte{'a'}, |
| 21 | expected: NotDefined, |
| 22 | }, |
| 23 | } |
| 24 | |
| 25 | for _, s := range scenarioTable { |
| 26 | t.Run(s.name, func(t *testing.T) { |
| 27 | key := GetKey(s.input) |
| 28 | if key != s.expected { |
| 29 | t.Errorf("Should be %s, but got %s", key, s.expected) |
| 30 | } |
| 31 | }) |
| 32 | } |
| 33 | } |