summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_go.rb54
1 files changed, 52 insertions, 2 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index 06c3aefd..dfb338e8 100755
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -2752,8 +2752,9 @@ class TestGoFZF < TestBase
def assert_block(expected, lines)
cols = expected.lines.map(&:chomp).map(&:length).max
- actual = lines.reverse.take(expected.lines.length).reverse.map { _1[0, cols].rstrip + "\n" }.join
- assert_equal_org expected, actual
+ top = lines.take(expected.lines.length).map { _1[0, cols].rstrip + "\n" }.join
+ bottom = lines.reverse.take(expected.lines.length).reverse.map { _1[0, cols].rstrip + "\n" }.join
+ assert_includes [top, bottom], expected
end
def test_height_range_fit
@@ -3268,6 +3269,55 @@ class TestGoFZF < TestBase
tmux.send_keys '99'
tmux.until { |lines| assert(lines.any? { |line| line.include?('0 / 0') }) }
end
+
+ def test_fzf_multi_line
+ tmux.send_keys %[(echo -en '0\\0'; echo -en '1\\n2\\0'; seq 1000) | fzf --read0 --multi --bind load:select-all --border rounded], :Enter
+ block = <<~BLOCK
+ │ ┃998
+ │ ┃999
+ │ ┃1000
+ │ ╹
+ │ ╻1
+ │ ╹2
+ │ >>0
+ │ 3/3 (3)
+ │ >
+ ╰───────────
+ BLOCK
+ tmux.until { assert_block(block, _1) }
+ tmux.send_keys :Up, :Up
+ block = <<~BLOCK
+ ╭───────
+ │ >╻1
+ │ >┃2
+ │ >┃3
+ BLOCK
+ tmux.until { assert_block(block, _1) }
+
+ block = <<~BLOCK
+ │ >┃
+ │
+ │ >
+ ╰───
+ BLOCK
+ tmux.until { assert_block(block, _1) }
+ end
+
+ def test_fzf_multi_line_reverse
+ tmux.send_keys %[(echo -en '0\\0'; echo -en '1\\n2\\0'; seq 1000) | fzf --read0 --multi --bind load:select-all --border rounded --reverse], :Enter
+ block = <<~BLOCK
+ ╭───────────
+ │ >
+ │ 3/3 (3)
+ │ >>0
+ │ ╻1
+ │ ╹2
+ │ ╻1
+ │ ┃2
+ │ ┃3
+ BLOCK
+ tmux.until { assert_block(block, _1) }
+ end
end
module TestShell