diff --git a/test/test_go.rb b/test/test_go.rb index d886c32..ef7aa3a 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