| 1 | //go:build windows |
| 2 | // +build windows |
| 3 | |
| 4 | package windowsconsole |
| 5 | |
| 6 | import ( |
| 7 | "testing" |
| 8 | |
| 9 | "github.com/Azure/go-ansiterm" |
| 10 | "github.com/Azure/go-ansiterm/winterm" |
| 11 | ) |
| 12 | |
| 13 | func TestKeyToString(t *testing.T) { |
| 14 | ke := &winterm.KEY_EVENT_RECORD{ |
| 15 | ControlKeyState: winterm.LEFT_ALT_PRESSED, |
| 16 | UnicodeChar: 65, // capital A |
| 17 | } |
| 18 | |
| 19 | const expected = ansiterm.KEY_ESC_N + "a" |
| 20 | out := keyToString(ke, nil) |
| 21 | if out != expected { |
| 22 | t.Errorf("expected %s, got %s", expected, out) |
| 23 | } |
| 24 | } |