summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-13 00:13:31 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-01-13 00:13:31 +0900
commitd83eb2800a09d86e17c0339d86bd1f22f68164a8 (patch)
tree0be6b9c97bf9f8434a367fe2996b82f4b4e36f95 /test
parent6f943112a9998d504a5660754f400786e79f80b2 (diff)
downloadfzf-d83eb2800a09d86e17c0339d86bd1f22f68164a8.tar.gz
Add change-nth action
Example: # Start with --nth 1, then 2, then 3, then back to the default, 1 echo 'foo foobar foobarbaz' | fzf --bind 'space:change-nth(2|3|)' --nth 1 -q foo Close #4172 Close #3109
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_go.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index db2d8f1d..b40bfb42 100755
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -3718,6 +3718,29 @@ class TestGoFZF < TestBase
BLOCK
tmux.until { assert_block(block, _1) }
end
+
+ def test_change_nth
+ input = [
+ 'foo bar bar bar bar',
+ 'foo foo bar bar bar',
+ 'foo foo foo bar bar',
+ 'foo foo foo foo bar'
+ ]
+ writelines(input)
+ tmux.send_keys %(#{FZF} -qfoo -n1 --bind 'space:change-nth:2|3|4|5|' < #{tempname}), :Enter
+
+ tmux.until { |lines| assert_equal 4, lines.match_count }
+ tmux.send_keys :Space
+ tmux.until { |lines| assert_equal 3, lines.match_count }
+ tmux.send_keys :Space
+ tmux.until { |lines| assert_equal 2, lines.match_count }
+ tmux.send_keys :Space
+ tmux.until { |lines| assert_equal 1, lines.match_count }
+ tmux.send_keys :Space
+ tmux.until { |lines| assert_equal 0, lines.match_count }
+ tmux.send_keys :Space
+ tmux.until { |lines| assert_equal 4, lines.match_count }
+ end
end
module TestShell