summaryrefslogtreecommitdiff
path: root/test/acceptance
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2017-02-07 18:14:09 -0800
committerJohn Hawthorn <john.hawthorn@gmail.com>2017-02-07 18:14:09 -0800
commit699d03a39957a681dc2ea3cf750399e14df6f94b (patch)
tree7834ec71837ea403f2e027375481142e118817a4 /test/acceptance
parent5aeaaa3de01b98e935dab1367cf2a7900feaecf3 (diff)
Add acceptance tests for --lines and --prompt
Diffstat (limited to 'test/acceptance')
-rw-r--r--test/acceptance/acceptance_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/acceptance/acceptance_test.rb b/test/acceptance/acceptance_test.rb
index 67a0ccf..f5ec243 100644
--- 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