m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 00:03:39 -05:00

Fix invalid cache lookups

This commit is contained in:
Junegunn Choi
2017-08-08 13:22:30 +09:00
parent b208aa675e
commit 999d374f0c
3 changed files with 56 additions and 29 deletions

View File

@@ -719,6 +719,38 @@ class TestGoFZF < TestBase
tmux.send_keys :Enter
end
def test_invalid_cache_query_type
command = %[(echo 'foo\\$bar'; echo 'barfoo'; echo 'foo^bar'; echo \\"foo'1-2\\"; seq 100) | #{fzf}]
# Suffix match
tmux.send_keys command, :Enter
tmux.until { |lines| lines.match_count == 104 }
tmux.send_keys 'foo$'
tmux.until { |lines| lines.match_count == 1 }
tmux.send_keys 'bar'
tmux.until { |lines| lines.match_count == 1 }
tmux.send_keys :Enter
# Prefix match
tmux.prepare
tmux.send_keys command, :Enter
tmux.until { |lines| lines.match_count == 104 }
tmux.send_keys '^bar'
tmux.until { |lines| lines.match_count == 1 }
tmux.send_keys 'C-a', 'foo'
tmux.until { |lines| lines.match_count == 1 }
tmux.send_keys :Enter
# Exact match
tmux.prepare
tmux.send_keys command, :Enter
tmux.until { |lines| lines.match_count == 104 }
tmux.send_keys "'12"
tmux.until { |lines| lines.match_count == 1 }
tmux.send_keys 'C-a', 'foo'
tmux.until { |lines| lines.match_count == 1 }
end
def test_smart_case_for_each_term
assert_equal 1, `echo Foo bar | #{FZF} -x -f "foo Fbar" | wc -l`.to_i
end