summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-10-09 13:42:18 -0300
committerAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-10-09 15:05:19 -0300
commit94adabbb5dd27bdccd6e3afdbf0d703965cf8113 (patch)
tree8d3754793256b1b6779f0051fd0276d0d58fa7cf
parent8e6cef58caf8d56da1cbda04c83c3882d1496468 (diff)
downloadhighline-94adabbb5dd27bdccd6e3afdbf0d703965cf8113.tar.gz
Add test for non pagination when same line count of HighLine#page_at
-rwxr-xr-xtest/tc_highline.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/tc_highline.rb b/test/tc_highline.rb
index 2b4e1a8..4b32a69 100755
--- a/test/tc_highline.rb
+++ b/test/tc_highline.rb
@@ -978,6 +978,35 @@ class TestHighLine < Test::Unit::TestCase
@output.string )
end
+ def test_statement_lines_count_equal_to_page_at_shouldnt_paginate
+ @terminal.page_at = 6
+
+ @input << "\n"
+ @input.rewind
+
+ list = "a\nb\nc\nd\ne\nf\n"
+
+ @terminal.say(list)
+ assert_equal(list, @output.string)
+ end
+
+ def test_statement_with_one_line_bigger_than_page_at_should_paginate
+ @terminal.page_at = 6
+
+ @input << "\n"
+ @input.rewind
+
+ list = "a\nb\nc\nd\ne\nf\ng\n"
+
+ paginated =
+ "a\nb\nc\nd\ne\nf\n" \
+ "\n-- press enter/return to continue or q to stop -- \n\n" \
+ "g\n"
+
+ @terminal.say(list)
+ assert_equal(paginated, @output.string)
+ end
+
def test_quiting_paging_shouldnt_raise
# See https://github.com/JEG2/highline/issues/168