Skip to content

Commit

Permalink
Add retries to CTRL-R tests to avoid intermittent errors on Travis CI
Browse files Browse the repository at this point in the history
junegunn committed Mar 7, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent baf882a commit 7c40a42
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/test_go.rb
Original file line number Diff line number Diff line change
@@ -1853,9 +1853,11 @@ def test_ctrl_r
def test_ctrl_r_multiline
tmux.send_keys 'echo "foo', :Enter, 'bar"', :Enter
tmux.until { |lines| lines[-2..-1] == ['foo', 'bar'] }
tmux.prepare
tmux.send_keys 'C-r'
tmux.until { |lines| lines[-1] == '>' }
retries do
tmux.prepare
tmux.send_keys 'C-r'
tmux.until { |lines| lines[-1] == '>' }
end
tmux.send_keys 'foo bar'
tmux.until { |lines| lines[-3].end_with? 'bar"' }
tmux.send_keys :Enter
@@ -1867,11 +1869,13 @@ def test_ctrl_r_multiline
def test_ctrl_r_abort
skip "doesn't restore the original line when search is aborted pre Bash 4" if shell == :bash && /(?<= version )\d+/.match(`#{Shell.bash} --version`).to_s.to_i < 4
%w[foo ' "].each do |query|
tmux.prepare
tmux.send_keys(query)
tmux.until { |lines| lines[-1].start_with? query }
tmux.send_keys 'C-r'
tmux.until { |lines| lines[-1] == "> #{query}" }
retries do
tmux.prepare
tmux.send_keys(:Space, 'C-e', 'C-u', query)
tmux.until { |lines| lines[-1].start_with? query }
tmux.send_keys 'C-r'
tmux.until { |lines| lines[-1] == "> #{query}" }
end
tmux.send_keys 'C-g'
tmux.until { |lines| lines[-1].start_with? query }
end

0 comments on commit 7c40a42

Please sign in to comment.