From e975bd0c8da25b51c0713d951af10cbd44cc3e15 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 10 Nov 2019 13:13:45 +0900 Subject: [PATCH] Add test cases for --phony and reload action --- test/test_go.rb | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/test_go.rb b/test/test_go.rb index 9282f9ee..1dbbf5ce 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -277,7 +277,7 @@ class TestGoFZF < TestBase def test_fzf_default_command_failure tmux.send_keys fzf.sub('FZF_DEFAULT_COMMAND=', 'FZF_DEFAULT_COMMAND=false'), :Enter - tmux.until { |lines| lines[-2].include?('FZF_DEFAULT_COMMAND failed') } + tmux.until { |lines| lines[-2].include?('Command failed: false') } tmux.send_keys :Enter end @@ -1612,6 +1612,26 @@ class TestGoFZF < TestBase tmux.send_keys "#{FZF} --preview 'cat #{tempname}'", :Enter tmux.until { |lines| lines[1].include?('+ green') } end + + def test_phony + tmux.send_keys %(seq 1000 | #{FZF} --query 333 --phony --preview 'echo {} {q}'), :Enter + tmux.until { |lines| lines.match_count == 1000 } + tmux.until { |lines| lines[1].include?('1 333') } + tmux.send_keys 'foo' + tmux.until { |lines| lines.match_count == 1000 } + tmux.until { |lines| lines[1].include?('1 333foo') } + end + + def test_reload + tmux.send_keys %(seq 1000 | #{FZF} --bind 'change:reload(seq {q}),a:reload(seq 100),b:reload:seq 200'), :Enter + tmux.until { |lines| lines.match_count == 1000 } + tmux.send_keys 'a' + tmux.until { |lines| lines.item_count == 100 && lines.match_count == 100 } + tmux.send_keys 'b' + tmux.until { |lines| lines.item_count == 200 && lines.match_count == 200 } + tmux.send_keys '555' + tmux.until { |lines| lines.item_count == 555 && lines.match_count == 1 } + end end module TestShell