From 3a644b16a42d26134d986e58675e74c99de8c659 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 8 Jun 2016 02:04:40 +0900 Subject: Update test_execute (#590) --- test/test_go.rb | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/test_go.rb b/test/test_go.rb index d886c323..ef7aa3a4 100644 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -869,31 +869,34 @@ 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}\\"] + opts = %[--bind \\"alt-a:execute(echo [{}] >> #{output}),alt-b:execute[echo /{}{}/ >> #{output}],C:execute:echo /{}{}{}/ >> #{output}\\"] wait = lambda { |exp| tmux.until { |lines| lines[-2].include? exp } } - tmux.send_keys "seq 100 | #{fzf opts}; sync", :Enter - wait['100/100'] + writelines tempname, %w[foo'bar foo"bar foo$bar] + tmux.send_keys "cat #{tempname} | #{fzf opts}; sync", :Enter + wait['3/3'] tmux.send_keys :Escape, :a - wait['/100'] + wait['/3'] tmux.send_keys :Escape, :a - wait['/100'] + wait['/3'] tmux.send_keys :Up tmux.send_keys :Escape, :b - wait['/100'] + wait['/3'] tmux.send_keys :Escape, :b - wait['/100'] + wait['/3'] tmux.send_keys :Up tmux.send_keys :C - wait['100/100'] - tmux.send_keys 'foobar' - wait['0/100'] + wait['3/3'] + tmux.send_keys 'barfoo' + wait['0/3'] tmux.send_keys :Escape, :a - wait['/100'] + wait['/3'] tmux.send_keys :Escape, :b - wait['/100'] + wait['/3'] tmux.send_keys :Enter readonce - assert_equal ['["1"]', '["1"]', '("2"), ("2")', '("2"), ("2")', '("3"), ["3"], @"3"@'], + assert_equal %w[[foo'bar] [foo'bar] + /foo"barfoo"bar/ /foo"barfoo"bar/ + /foo$barfoo$barfoo$bar/], File.readlines(output).map(&:chomp) ensure File.unlink output rescue nil -- cgit v1.2.3