File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -312,4 +312,18 @@ def test_boundary_match
312312 assert_equal expected , result
313313 end
314314 end
315+
316+ def test_accept_nth_with_filter
317+ # Single field selection
318+ assert_equal 'three' , `echo 'one two three' | #{ FZF } -d' ' --with-nth 1 --accept-nth -1 -f one` . chomp
319+
320+ # Multiple field selection
321+ writelines ( [ 'ID001:John:Developer' , 'ID002:Jane:Manager' , 'ID003:Bob:Designer' ] )
322+ assert_equal 'ID001' , `#{ FZF } -d: --with-nth 2 --accept-nth 1 -f John < #{ tempname } ` . chomp
323+ assert_equal "ID002:Manager" , `#{ FZF } -d: --with-nth 2 --accept-nth 1,3 -f Jane < #{ tempname } ` . chomp
324+
325+ # Test with different delimiters
326+ writelines ( [ 'emp001 Alice Engineering' , 'emp002 Bob Marketing' ] )
327+ assert_equal 'emp001' , `#{ FZF } -d' ' --with-nth 2 --accept-nth 1 -f Alice < #{ tempname } ` . chomp
328+ end
315329end
You can’t perform that action at this time.
0 commit comments