diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2016-02-16 12:32:05 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2016-02-16 12:32:05 +0900 |
commit | a568120e42a86bc37b87ae6facab91f7b35f988e (patch) | |
tree | 30f9d8e3df8288d1d17e5e67274f38cc3c2d5cbc /test | |
parent | e57182c6580d887c85cf0ec0f9d0032671dd585a (diff) |
Fix #494 - _fzf_complete hangs on zsh when not using tmux pane
Diffstat (limited to 'test')
-rw-r--r-- | test/test_go.rb | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/test/test_go.rb b/test/test_go.rb index 5ea255aa..7a2d0039 100644 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -1140,7 +1140,7 @@ class TestGoFZF < TestBase private def writelines path, lines File.unlink path while File.exists? path - File.open(path, 'w') { |f| f << lines.join($/) } + File.open(path, 'w') { |f| f << lines.join($/) + $/ } end end @@ -1355,23 +1355,42 @@ module CompletionTest tmux.send_keys 'C-L' lines[-1] == "kill #{pid}" end - - def test_custom_completion - tmux.send_keys '_fzf_compgen_path() { echo "\$1"; seq 10; }', :Enter - tmux.prepare - tmux.send_keys 'ls /tmp/**', :Tab, pane: 0 - tmux.until(1) { |lines| lines.item_count == 11 } - tmux.send_keys :BTab, :BTab, :BTab - tmux.until(1) { |lines| lines[-2].include? '(3)' } - tmux.send_keys :Enter - tmux.until do |lines| - tmux.send_keys 'C-L' - lines[-1] == "ls /tmp 1 2" - end - end ensure Process.kill 'KILL', pid.to_i rescue nil if pid end + + def test_custom_completion + tmux.send_keys '_fzf_compgen_path() { echo "\$1"; seq 10; }', :Enter + tmux.prepare + tmux.send_keys 'ls /tmp/**', :Tab, pane: 0 + tmux.until(1) { |lines| lines.item_count == 11 } + tmux.send_keys :BTab, :BTab, :BTab + tmux.until(1) { |lines| lines[-2].include? '(3)' } + tmux.send_keys :Enter + tmux.until do |lines| + tmux.send_keys 'C-L' + lines[-1] == "ls /tmp 1 2" + end + end + + def test_unset_completion + tmux.send_keys 'export FOO=BAR', :Enter + tmux.prepare + + # Using tmux + tmux.send_keys 'unset FOO**', :Tab, pane: 0 + tmux.until(1) { |lines| lines[-2].include? ' 1/' } + tmux.send_keys :Enter + tmux.until { |lines| lines[-1] == 'unset FOO' } + tmux.send_keys 'C-c' + + # FZF_TMUX=0 + new_shell + tmux.send_keys 'unset FOO**', :Tab + tmux.until { |lines| lines[-2].include? ' 1/' } + tmux.send_keys :Enter + tmux.until { |lines| lines[-1] == 'unset FOO' } + end end class TestBash < TestBase |