From fcd7e8768dc4a23f6e4f1aec57c9d2236ebe7fae Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 19 Mar 2023 15:42:47 +0900 Subject: Omit port number in `--listen` for automatic port assignment Close #3200 --- test/test_go.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_go.rb b/test/test_go.rb index 07a7c195..de81f6e5 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -2629,11 +2629,17 @@ class TestGoFZF < TestBase end def test_listen - tmux.send_keys 'seq 10 | fzf --listen 6266', :Enter - tmux.until { |lines| assert_equal 10, lines.item_count } - Net::HTTP.post(URI('http://localhost:6266'), 'change-query(yo)+reload(seq 100)+change-prompt:hundred> ') - tmux.until { |lines| assert_equal 100, lines.item_count } - tmux.until { |lines| assert_equal 'hundred> yo', lines[-1] } + { '--listen 6266' => lambda { URI('http://localhost:6266') }, + "--listen --sync --bind 'start:execute-silent:echo $FZF_PORT > /tmp/fzf-port'" => + lambda { URI("http://localhost:#{File.read('/tmp/fzf-port').chomp}") } }.each do |opts, fn| + tmux.send_keys "seq 10 | fzf #{opts}", :Enter + tmux.until { |lines| assert_equal 10, lines.item_count } + Net::HTTP.post(fn.call, 'change-query(yo)+reload(seq 100)+change-prompt:hundred> ') + tmux.until { |lines| assert_equal 100, lines.item_count } + tmux.until { |lines| assert_equal 'hundred> yo', lines[-1] } + teardown + setup + end end def test_toggle_alternative_preview_window -- cgit v1.2.3