summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-05-11 01:40:49 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-05-11 01:40:49 +0900
commit4ab75b68dcbe93baf8ef65a3cb6230351deae46a (patch)
tree28aab3ba8cbb5abee742f815747bb9591e401976
parent73cb70dbb34d71ef88d9e161e6f8a6eed81eefaa (diff)
Fix flaky test case: test_execute
Should wait until execute action completes
-rw-r--r--test/test_go.rb23
1 files changed, 17 insertions, 6 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index 19759fea..64b4e26f 100644
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -859,16 +859,27 @@ class TestGoFZF < TestBase
def test_execute
output = '/tmp/fzf-test-execute'
opts = %[--bind \\"alt-a:execute(echo '[{}]' >> #{output}),alt-b:execute[echo '({}), ({})' >> #{output}],C:execute:echo '({}), [{}], @{}@' >> #{output}\\"]
- tmux.send_keys "seq 100 | #{fzf opts}", :Enter
- tmux.until { |lines| lines[-2].include? '100/100' }
- tmux.send_keys :Escape, :a, :Escape, :a
+ wait = lambda { |exp| tmux.until { |lines| lines[-2].include? exp } }
+ tmux.send_keys "seq 100 | #{fzf opts}; sync", :Enter
+ wait['100/100']
+ tmux.send_keys :Escape, :a
+ wait['/100']
+ tmux.send_keys :Escape, :a
+ wait['/100']
tmux.send_keys :Up
- tmux.send_keys :Escape, :b, :Escape, :b
+ tmux.send_keys :Escape, :b
+ wait['/100']
+ tmux.send_keys :Escape, :b
+ wait['/100']
tmux.send_keys :Up
tmux.send_keys :C
+ wait['100/100']
tmux.send_keys 'foobar'
- tmux.until { |lines| lines[-2].include? '0/100' }
- tmux.send_keys :Escape, :a, :Escape, :b, :Escape, :c
+ wait['0/100']
+ tmux.send_keys :Escape, :a
+ wait['/100']
+ tmux.send_keys :Escape, :b
+ wait['/100']
tmux.send_keys :Enter
readonce
assert_equal ['["1"]', '["1"]', '("2"), ("2")', '("2"), ("2")', '("3"), ["3"], @"3"@'],