summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-03-29 02:59:32 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-03-29 02:59:32 +0900
commit2a167aa030b244060fc479d2b88fdb9b9171d026 (patch)
tree69b994e5b97ad9a07107569fcb1227de7c886cbb /test
parent9cfecf7f0bb52441c27b769427fdf05f45b3110d (diff)
Implement --expect option to support simple key bindings (#163)
Diffstat (limited to 'test')
-rw-r--r--test/test_go.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index 6f67da74..adfc0d01 100644
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -425,6 +425,33 @@ class TestGoFZF < TestBase
tmux.send_keys :BTab, :BTab, :BTab, :Enter
assert_equal %w[1000 900 800], readonce.split($/)
end
+
+ def test_expect
+ test = lambda do |key, feed, expected = key|
+ tmux.send_keys "seq 1 100 | #{fzf :expect, key}", :Enter
+ tmux.until { |lines| lines[-2].include? '100/100' }
+ tmux.send_keys '55'
+ tmux.send_keys *feed
+ assert_equal [expected, '55'], readonce.split($/)
+ end
+ test.call 'ctrl-t', 'C-T'
+ test.call 'ctrl-t', 'Enter', ''
+ test.call 'alt-c', [:Escape, :c]
+ test.call 'f1', 'f1'
+ test.call 'f2', 'f2'
+ test.call 'f3', 'f3'
+ test.call 'f2,f4', 'f2', 'f2'
+ test.call 'f2,f4', 'f4', 'f4'
+ test.call '@', '@'
+ end
+
+ def test_expect_print_query
+ tmux.send_keys "seq 1 100 | #{fzf '--expect=alt-z', :print_query}", :Enter
+ tmux.until { |lines| lines[-2].include? '100/100' }
+ tmux.send_keys '55'
+ tmux.send_keys :Escape, :z
+ assert_equal ['55', 'alt-z', '55'], readonce.split($/)
+ end
end
module TestShell