blob: dda9b3249547157b78de06741f0421f4ba7e3ac1 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
require_relative 'helper'
require "reline"
class Reline::Terminfo::Test < Reline::TestCase
def setup
Reline::Terminfo.setupterm(0, 2)
end
def test_tigetstr
assert Reline::Terminfo.tigetstr('khome')
rescue Reline::Terminfo::TerminfoError => e
omit e.message
end
def test_tigetstr_with_error
assert_raise(Reline::Terminfo::TerminfoError) { Reline::Terminfo.tigetstr('unknown') }
assert_raise(Reline::Terminfo::TerminfoError) { Reline::Terminfo.tigetstr(nil) }
end
def test_tiparm
assert Reline::Terminfo.tigetstr('khome').tiparm
rescue Reline::Terminfo::TerminfoError => e
omit e.message
end
def test_tigetstr_with_param
assert Reline::Terminfo.tigetstr('cuu').include?('%p1%d')
rescue Reline::Terminfo::TerminfoError => e
omit e.message
end
def test_tiparm_with_param
assert Reline::Terminfo.tigetstr('cuu').tiparm(4649).include?('4649')
rescue Reline::Terminfo::TerminfoError => e
omit e.message
end
def test_tigetflag
assert_instance_of Integer, Reline::Terminfo.tigetflag('xenl')
rescue Reline::Terminfo::TerminfoError => e
omit e.message
end
def test_tigetflag_with_error
assert_raise(Reline::Terminfo::TerminfoError) { Reline::Terminfo.tigetflag('cuu') }
assert_raise(Reline::Terminfo::TerminfoError) { Reline::Terminfo.tigetflag('unknown') }
assert_raise(Reline::Terminfo::TerminfoError) { Reline::Terminfo.tigetflag(nil) }
end
def test_tigetnum
assert_instance_of Integer, Reline::Terminfo.tigetnum('colors')
rescue Reline::Terminfo::TerminfoError => e
omit e.message
end
def test_tigetnum_with_error
assert_raise(Reline::Terminfo::TerminfoError) { Reline::Terminfo.tigetnum('cuu') }
assert_raise(Reline::Terminfo::TerminfoError) { Reline::Terminfo.tigetnum('unknown') }
assert_raise(Reline::Terminfo::TerminfoError) { Reline::Terminfo.tigetnum(nil) }
end
end if Reline::Terminfo.enabled?
|