summaryrefslogtreecommitdiff
path: root/test/test_core.rb
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-02-09 13:22:33 +0900
committerGitHub <noreply@github.com>2025-02-09 13:22:33 +0900
commit67dd7e1923f8084de1064bf54659100626c1e0ef (patch)
treea89ef048133cadf06854e891932c622580590f21 /test/test_core.rb
parent2b584586ed1caf15429625da981575ee35d407b8 (diff)
downloadfzf-67dd7e1923f8084de1064bf54659100626c1e0ef.tar.gz
Add 'exclude' action for excluding current/selected items from the result (#4231)
Close #4185
Diffstat (limited to 'test/test_core.rb')
-rw-r--r--test/test_core.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test_core.rb b/test/test_core.rb
index e15ab8ee..4eee51b2 100644
--- a/test/test_core.rb
+++ b/test/test_core.rb
@@ -1666,6 +1666,30 @@ class TestCore < TestInteractive
end
end
+ def test_exclude
+ tmux.send_keys %(seq 1000 | #{FZF} --multi --bind 'a:exclude,b:reload(seq 1000),c:reload-sync(seq 1000)'), :Enter
+
+ tmux.until { |lines| assert_equal 1000, lines.match_count }
+ tmux.until { |lines| assert_includes lines, '> 1' }
+ tmux.send_keys :a
+ tmux.until { |lines| assert_includes lines, '> 2' }
+ tmux.until { |lines| assert_equal 999, lines.match_count }
+ tmux.send_keys :Up, :BTab, :BTab, :BTab, :a
+ tmux.until { |lines| assert_equal 996, lines.match_count }
+ tmux.until { |lines| assert_includes lines, '> 9' }
+ tmux.send_keys :b
+ tmux.until { |lines| assert_equal 1000, lines.match_count }
+ tmux.until { |lines| assert_includes lines, '> 5' }
+ tmux.send_keys :Tab, :Tab, :Tab, :a
+ tmux.until { |lines| assert_equal 997, lines.match_count }
+ tmux.until { |lines| assert_includes lines, '> 2' }
+ tmux.send_keys :c
+ tmux.until { |lines| assert_equal 1000, lines.match_count }
+ tmux.until { |lines| assert_includes lines, '> 2' }
+
+ # TODO: We should also check the behavior of 'exclude' during reloads
+ end
+
def test_accept_nth
tmux.send_keys %((echo "foo bar baz"; echo "bar baz foo") | #{FZF} --multi --accept-nth 2,2 --sync --bind start:select-all+accept > #{tempname}), :Enter
wait do