File: ansi_reader_test.go

package info (click to toggle)
golang-github-moby-term 0.0~git20230502.9c3c875-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 180 kB
  • sloc: makefile: 2
file content (24 lines) | stat: -rw-r--r-- 462 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//go:build windows
// +build windows

package windowsconsole

import (
	"testing"

	"github.com/Azure/go-ansiterm"
	"github.com/Azure/go-ansiterm/winterm"
)

func TestKeyToString(t *testing.T) {
	ke := &winterm.KEY_EVENT_RECORD{
		ControlKeyState: winterm.LEFT_ALT_PRESSED,
		UnicodeChar:     65, // capital A
	}

	const expected = ansiterm.KEY_ESC_N + "a"
	out := keyToString(ke, nil)
	if out != expected {
		t.Errorf("expected %s, got %s", expected, out)
	}
}