summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-02-12 20:50:01 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-02-12 20:53:32 +0900
commit9abf2c8c9ca625f30ff0775316f51ad798a922f3 (patch)
tree0ed698337059cc4c5e096df4bc0827e4d9dea56e /test
parent84e2262ad63df2112f16b2a80fc661294c3da45e (diff)
downloadfzf-9abf2c8c9ca625f30ff0775316f51ad798a922f3.tar.gz
Allow suffix match on --nth with custom --delimiter
When --nth is used with a custom --delimiter, the last delimiter was included in the search scope, forcing you to write the delimiter in a suffix-match query. This commit removes the last delimiter from the search scope. # No need to write 'bar,$' echo foo,bar,baz | fzf --delimiter , --nth 2 --filter 'bar$' This can be seen as a breaking change, but I'm gonna say it's a bug fix. Fix #3983
Diffstat (limited to 'test')
-rw-r--r--test/test_filter.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test_filter.rb b/test/test_filter.rb
index 718c6e57..3e604412 100644
--- a/test/test_filter.rb
+++ b/test/test_filter.rb
@@ -52,6 +52,12 @@ class TestFilter < TestBase
`find . -print0 | #{FZF} --read0 -e -f "^#{lines.last}$"`.chomp
end
+ def test_nth_suffix_match
+ assert_equal \
+ 'foo,bar,baz',
+ `echo foo,bar,baz | #{FZF} -d, -f'bar$' -n2`.chomp
+ end
+
def test_with_nth_basic
writelines(['hello world ', 'byebye'])
assert_equal \