diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2023-03-19 15:42:47 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-03-19 15:48:39 +0900 |
commit | fcd7e8768dc4a23f6e4f1aec57c9d2236ebe7fae (patch) | |
tree | 7d39262b031120ceebf516a0e844b4ac26766edd /test | |
parent | 3c34dd82750ca61a1ee7f329ed47fe01e6d1ee30 (diff) |
Omit port number in `--listen` for automatic port assignment
Close #3200
Diffstat (limited to 'test')
-rwxr-xr-x | test/test_go.rb | 16 |
1 files changed, 11 insertions, 5 deletions
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 |