blob: 5f898993ad19e335dd49b7548a63ba487d1a43af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env ruby
# coding: utf-8
require "minitest/autorun"
require "test_helper"
require "highline"
class TestHighLinePaginator < Minitest::Test
def setup
HighLine.reset
@input = StringIO.new
@output = StringIO.new
@terminal = HighLine.new(@input, @output)
end
def test_paging
@terminal.page_at = 22
@input << "\n\n"
@input.rewind
@terminal.say((1..50).map { |n| "This is line #{n}.\n"}.join)
assert_equal( (1..22).map { |n| "This is line #{n}.\n"}.join +
"\n-- press enter/return to continue or q to stop -- \n\n" +
(23..44).map { |n| "This is line #{n}.\n"}.join +
"\n-- press enter/return to continue or q to stop -- \n\n" +
(45..50).map { |n| "This is line #{n}.\n"}.join,
@output.string )
end
end
|