fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit e525f8bf347fb764d5541224d9daf114e123deda parent 2e81ceb4a51605340294e28cc4c0400c137b866f Author: John Hawthorn <john.hawthorn@gmail.com> Date: Tue, 7 Feb 2017 18:14:09 -0800 Add acceptance tests for --lines and --prompt Diffstat:
| M | test/acceptance/acceptance_test.rb | | | 28 | ++++++++++++++++++++++++++++ |
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/test/acceptance/acceptance_test.rb b/test/acceptance/acceptance_test.rb @@ -200,4 +200,32 @@ class FzyTest < Minitest::Test @tty.send_keys("\e[B\r") # and back up @tty.assert_matches "foo" end + + def test_lines + @tty = TTYtest.new_terminal(%{seq 10 | #{FZY_PATH}}) + @tty.assert_matches ">\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10" + + @tty = TTYtest.new_terminal(%{seq 20 | #{FZY_PATH}}) + @tty.assert_matches ">\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10" + + @tty = TTYtest.new_terminal(%{seq 10 | #{FZY_PATH} -l 5}) + @tty.assert_matches ">\n1\n2\n3\n4\n5" + + @tty = TTYtest.new_terminal(%{seq 10 | #{FZY_PATH} --lines=5}) + @tty.assert_matches ">\n1\n2\n3\n4\n5" + end + + def test_prompt + @tty = TTYtest.new_terminal(%{echo -n "" | #{FZY_PATH}}) + @tty.send_keys("foo") + @tty.assert_matches '> foo' + + @tty = TTYtest.new_terminal(%{echo -n "" | #{FZY_PATH} -p 'C:\\'}) + @tty.send_keys("foo") + @tty.assert_matches 'C:\foo' + + @tty = TTYtest.new_terminal(%{echo -n "" | #{FZY_PATH} --prompt="foo bar "}) + @tty.send_keys("baz") + @tty.assert_matches "foo bar baz" + end end