Fix flaky test cases

This commit is contained in:
Junegunn Choi 2018-06-01 18:21:34 +09:00
parent 2ff19084ca
commit 68ec3d1c10
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -1514,7 +1514,7 @@ module TestShell
lines = retries do lines = retries do
tmux.prepare tmux.prepare
tmux.send_keys :Escape, :c tmux.send_keys :Escape, :c
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
end end
expected = lines.reverse.select { |l| l.start_with? '>' }.first[2..-1] expected = lines.reverse.select { |l| l.start_with? '>' }.first[2..-1]
tmux.send_keys :Enter tmux.send_keys :Enter
@ -1551,7 +1551,7 @@ module TestShell
retries do retries do
tmux.prepare tmux.prepare
tmux.send_keys 'C-r' tmux.send_keys 'C-r'
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
end end
tmux.send_keys 'C-r' tmux.send_keys 'C-r'
tmux.send_keys '3d' tmux.send_keys '3d'
@ -1583,7 +1583,7 @@ module CompletionTest
end end
tmux.prepare tmux.prepare
tmux.send_keys 'cat /tmp/fzf-test/10**', :Tab tmux.send_keys 'cat /tmp/fzf-test/10**', :Tab
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
tmux.send_keys ' !d' tmux.send_keys ' !d'
tmux.until { |lines| lines.match_count == 2 } tmux.until { |lines| lines.match_count == 2 }
tmux.send_keys :Tab, :Tab tmux.send_keys :Tab, :Tab
@ -1597,7 +1597,7 @@ module CompletionTest
# ~USERNAME**<TAB> # ~USERNAME**<TAB>
tmux.send_keys 'C-u' tmux.send_keys 'C-u'
tmux.send_keys "cat ~#{ENV['USER']}**", :Tab tmux.send_keys "cat ~#{ENV['USER']}**", :Tab
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
tmux.send_keys "'.fzf-home" tmux.send_keys "'.fzf-home"
tmux.until { |lines| lines.select { |l| l.include? '.fzf-home' }.count > 1 } tmux.until { |lines| lines.select { |l| l.include? '.fzf-home' }.count > 1 }
tmux.send_keys :Enter tmux.send_keys :Enter
@ -1615,7 +1615,7 @@ module CompletionTest
# /tmp/fzf\ test**<TAB> # /tmp/fzf\ test**<TAB>
tmux.send_keys 'C-u' tmux.send_keys 'C-u'
tmux.send_keys 'cat /tmp/fzf\ test/**', :Tab tmux.send_keys 'cat /tmp/fzf\ test/**', :Tab
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
tmux.send_keys 'foobar$' tmux.send_keys 'foobar$'
tmux.until { |lines| lines.match_count == 1 } tmux.until { |lines| lines.match_count == 1 }
tmux.send_keys :Enter tmux.send_keys :Enter
@ -1635,7 +1635,7 @@ module CompletionTest
def test_file_completion_root def test_file_completion_root
tmux.send_keys 'ls /**', :Tab tmux.send_keys 'ls /**', :Tab
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
tmux.send_keys :Enter tmux.send_keys :Enter
end end
@ -1646,7 +1646,7 @@ module CompletionTest
FileUtils.touch '/tmp/fzf-test/d55/xxx' FileUtils.touch '/tmp/fzf-test/d55/xxx'
tmux.prepare tmux.prepare
tmux.send_keys 'cd /tmp/fzf-test/**', :Tab tmux.send_keys 'cd /tmp/fzf-test/**', :Tab
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
tmux.send_keys :Tab, :Tab # Tab does not work here tmux.send_keys :Tab, :Tab # Tab does not work here
tmux.send_keys 55 tmux.send_keys 55
tmux.until { |lines| lines.match_count == 1 } tmux.until { |lines| lines.match_count == 1 }
@ -1675,7 +1675,7 @@ module CompletionTest
tmux.prepare tmux.prepare
tmux.send_keys 'C-L' tmux.send_keys 'C-L'
tmux.send_keys 'kill ', :Tab tmux.send_keys 'kill ', :Tab
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
tmux.send_keys 'sleep12345' tmux.send_keys 'sleep12345'
tmux.until { |lines| lines.any_include? 'sleep 12345' } tmux.until { |lines| lines.any_include? 'sleep 12345' }
tmux.send_keys :Enter tmux.send_keys :Enter
@ -1694,7 +1694,7 @@ module CompletionTest
tmux.send_keys '_fzf_compgen_path() { echo "\$1"; seq 10; }', :Enter tmux.send_keys '_fzf_compgen_path() { echo "\$1"; seq 10; }', :Enter
tmux.prepare tmux.prepare
tmux.send_keys 'ls /tmp/**', :Tab tmux.send_keys 'ls /tmp/**', :Tab
tmux.until { |lines| lines.item_count == 11 } tmux.until { |lines| lines.match_count == 11 }
tmux.send_keys :Tab, :Tab, :Tab tmux.send_keys :Tab, :Tab, :Tab
tmux.until { |lines| lines.select_count == 3 } tmux.until { |lines| lines.select_count == 3 }
tmux.send_keys :Enter tmux.send_keys :Enter
@ -1767,7 +1767,7 @@ class TestBash < TestBase
tmux.paste '_completion_loader() { complete -o default fake; }' tmux.paste '_completion_loader() { complete -o default fake; }'
tmux.paste 'complete -F _fzf_path_completion -o default -o bashdefault fake' tmux.paste 'complete -F _fzf_path_completion -o default -o bashdefault fake'
tmux.send_keys 'fake /tmp/foo**', :Tab tmux.send_keys 'fake /tmp/foo**', :Tab
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
tmux.send_keys 'C-c' tmux.send_keys 'C-c'
tmux.prepare tmux.prepare
@ -1776,7 +1776,7 @@ class TestBash < TestBase
tmux.prepare tmux.prepare
tmux.send_keys 'fake /tmp/foo**', :Tab tmux.send_keys 'fake /tmp/foo**', :Tab
tmux.until { |lines| lines.item_count.positive? } tmux.until { |lines| lines.match_count.positive? }
end end
end end