diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2015-03-29 02:59:32 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-03-29 02:59:32 +0900 |
| commit | 2a167aa030b244060fc479d2b88fdb9b9171d026 (patch) | |
| tree | 69b994e5b97ad9a07107569fcb1227de7c886cbb /src/options_test.go | |
| parent | 9cfecf7f0bb52441c27b769427fdf05f45b3110d (diff) | |
| download | fzf-2a167aa030b244060fc479d2b88fdb9b9171d026.tar.gz | |
Implement --expect option to support simple key bindings (#163)
Diffstat (limited to 'src/options_test.go')
| -rw-r--r-- | src/options_test.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/options_test.go b/src/options_test.go index 782ad791..b20cd6a3 100644 --- a/src/options_test.go +++ b/src/options_test.go @@ -1,6 +1,10 @@ package fzf -import "testing" +import ( + "testing" + + "github.com/junegunn/fzf/src/curses" +) func TestDelimiterRegex(t *testing.T) { rx := delimiterRegexp("*") @@ -65,3 +69,22 @@ func TestIrrelevantNth(t *testing.T) { } } } + +func TestExpectKeys(t *testing.T) { + keys := parseKeyChords("ctrl-z,alt-z,f2,@,Alt-a,!,ctrl-G,J,g") + check := func(key int, expected int) { + if key != expected { + t.Errorf("%d != %d", key, expected) + } + } + check(len(keys), 9) + check(keys[0], curses.CtrlZ) + check(keys[1], curses.AltZ) + check(keys[2], curses.F2) + check(keys[3], curses.AltZ+'@') + check(keys[4], curses.AltA) + check(keys[5], curses.AltZ+'!') + check(keys[6], curses.CtrlA+'g'-'a') + check(keys[7], curses.AltZ+'J') + check(keys[8], curses.AltZ+'g') +} |
