ttytest2 0.9.6 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +18 -18
- data/.gitignore +5 -5
- data/Gemfile +5 -5
- data/README.md +225 -201
- data/Rakefile +21 -21
- data/examples/canonical_integration_tests.rb +85 -85
- data/examples/noncanonical_integration_tests.rb +80 -80
- data/lib/ttytest/capture.rb +64 -64
- data/lib/ttytest/constants.rb +18 -18
- data/lib/ttytest/matchers.rb +157 -130
- data/lib/ttytest/terminal.rb +139 -133
- data/lib/ttytest/tmux/driver.rb +79 -79
- data/lib/ttytest/tmux/session.rb +159 -159
- data/lib/ttytest/tmux/tmux.conf +3 -3
- data/lib/ttytest/version.rb +5 -5
- data/lib/ttytest.rb +27 -27
- data/notes.txt +7 -7
- data/ttytest2.gemspec +31 -31
- metadata +3 -3
@@ -1,85 +1,85 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# example testing a noncanonical shell, ncsh
|
5
|
-
|
6
|
-
require 'ttytest'
|
7
|
-
|
8
|
-
START_COL = 19
|
9
|
-
|
10
|
-
def assert_check_new_row(row)
|
11
|
-
@tty.assert_row_starts_with(row, "#{ENV['USER']}:")
|
12
|
-
@tty.assert_row_like(row, 'ncsh')
|
13
|
-
@tty.assert_row_ends_with(row, '$')
|
14
|
-
@tty.assert_cursor_position(START_COL, row)
|
15
|
-
end
|
16
|
-
|
17
|
-
@tty = TTYtest.new_terminal(%(PS1='$ ' ./bin/ncsh), width: 80, height: 24)
|
18
|
-
|
19
|
-
row = 0
|
20
|
-
|
21
|
-
# # # # Basic Tests # # # #
|
22
|
-
puts 'Starting basic tests'
|
23
|
-
|
24
|
-
@tty.assert_row_starts_with(row, 'ncsh: startup time: ')
|
25
|
-
row += 1
|
26
|
-
|
27
|
-
assert_check_new_row(row)
|
28
|
-
@tty.send_keys(%(ls))
|
29
|
-
@tty.assert_cursor_position(START_COL + 2, 1)
|
30
|
-
@tty.send_newline
|
31
|
-
@tty.assert_row_ends_with(row, 'ls')
|
32
|
-
row += 1
|
33
|
-
@tty.assert_row_starts_with(row, 'LICENSE')
|
34
|
-
row = 9
|
35
|
-
|
36
|
-
assert_check_new_row(row)
|
37
|
-
@tty.send_keys(%(echo hello))
|
38
|
-
@tty.send_newline
|
39
|
-
row += 1
|
40
|
-
@tty.assert_row(row, 'hello')
|
41
|
-
row += 1
|
42
|
-
|
43
|
-
assert_check_new_row(row)
|
44
|
-
@tty.send_keys(%(lss)) # send a bad command
|
45
|
-
@tty.send_newline
|
46
|
-
row += 1
|
47
|
-
@tty.assert_row(row, 'ncsh: Could not find command or directory: No such file or directory')
|
48
|
-
row += 1
|
49
|
-
|
50
|
-
puts 'Starting backspace tests'
|
51
|
-
|
52
|
-
# end of line backspace
|
53
|
-
assert_check_new_row(row)
|
54
|
-
@tty.send_keys(%(l))
|
55
|
-
@tty.send_backspace
|
56
|
-
assert_check_new_row(row)
|
57
|
-
|
58
|
-
# multiple end of line backspaces
|
59
|
-
@tty.send_keys(%(lsssss))
|
60
|
-
@tty.send_backspaces(4)
|
61
|
-
@tty.assert_row_ends_with(row, 'ls')
|
62
|
-
@tty.send_backspaces(2)
|
63
|
-
@tty.send_keys(%(echo hello)) # make sure buffer is properly formed after backspaces
|
64
|
-
@tty.send_newline
|
65
|
-
row += 1
|
66
|
-
@tty.assert_row(row, 'hello')
|
67
|
-
row += 1
|
68
|
-
|
69
|
-
# midline backspace
|
70
|
-
assert_check_new_row(row)
|
71
|
-
@tty.send_keys(%(lsssss))
|
72
|
-
@tty.assert_cursor_position(START_COL + 6, row)
|
73
|
-
@tty.send_left_arrows(2)
|
74
|
-
@tty.assert_cursor_position(START_COL + 4, row)
|
75
|
-
@tty.send_backspaces(4)
|
76
|
-
@tty.assert_cursor_position(START_COL, row)
|
77
|
-
@tty.assert_row_ends_with(row, '$ ss')
|
78
|
-
@tty.send_right_arrows(2)
|
79
|
-
@tty.assert_cursor_position(START_COL + 2, row)
|
80
|
-
@tty.send_backspaces(2)
|
81
|
-
@tty.assert_cursor_position(START_COL, row)
|
82
|
-
@tty.send_keys(%(echo hello)) # make sure buffer is properly formed after backspaces
|
83
|
-
@tty.send_newline
|
84
|
-
row += 1
|
85
|
-
@tty.assert_row(row, 'hello')
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# example testing a noncanonical shell, ncsh
|
5
|
+
|
6
|
+
require 'ttytest'
|
7
|
+
|
8
|
+
START_COL = 19
|
9
|
+
|
10
|
+
def assert_check_new_row(row)
|
11
|
+
@tty.assert_row_starts_with(row, "#{ENV['USER']}:")
|
12
|
+
@tty.assert_row_like(row, 'ncsh')
|
13
|
+
@tty.assert_row_ends_with(row, '$')
|
14
|
+
@tty.assert_cursor_position(START_COL, row)
|
15
|
+
end
|
16
|
+
|
17
|
+
@tty = TTYtest.new_terminal(%(PS1='$ ' ./bin/ncsh), width: 80, height: 24)
|
18
|
+
|
19
|
+
row = 0
|
20
|
+
|
21
|
+
# # # # Basic Tests # # # #
|
22
|
+
puts 'Starting basic tests'
|
23
|
+
|
24
|
+
@tty.assert_row_starts_with(row, 'ncsh: startup time: ')
|
25
|
+
row += 1
|
26
|
+
|
27
|
+
assert_check_new_row(row)
|
28
|
+
@tty.send_keys(%(ls))
|
29
|
+
@tty.assert_cursor_position(START_COL + 2, 1)
|
30
|
+
@tty.send_newline
|
31
|
+
@tty.assert_row_ends_with(row, 'ls')
|
32
|
+
row += 1
|
33
|
+
@tty.assert_row_starts_with(row, 'LICENSE')
|
34
|
+
row = 9
|
35
|
+
|
36
|
+
assert_check_new_row(row)
|
37
|
+
@tty.send_keys(%(echo hello))
|
38
|
+
@tty.send_newline
|
39
|
+
row += 1
|
40
|
+
@tty.assert_row(row, 'hello')
|
41
|
+
row += 1
|
42
|
+
|
43
|
+
assert_check_new_row(row)
|
44
|
+
@tty.send_keys(%(lss)) # send a bad command
|
45
|
+
@tty.send_newline
|
46
|
+
row += 1
|
47
|
+
@tty.assert_row(row, 'ncsh: Could not find command or directory: No such file or directory')
|
48
|
+
row += 1
|
49
|
+
|
50
|
+
puts 'Starting backspace tests'
|
51
|
+
|
52
|
+
# end of line backspace
|
53
|
+
assert_check_new_row(row)
|
54
|
+
@tty.send_keys(%(l))
|
55
|
+
@tty.send_backspace
|
56
|
+
assert_check_new_row(row)
|
57
|
+
|
58
|
+
# multiple end of line backspaces
|
59
|
+
@tty.send_keys(%(lsssss))
|
60
|
+
@tty.send_backspaces(4)
|
61
|
+
@tty.assert_row_ends_with(row, 'ls')
|
62
|
+
@tty.send_backspaces(2)
|
63
|
+
@tty.send_keys(%(echo hello)) # make sure buffer is properly formed after backspaces
|
64
|
+
@tty.send_newline
|
65
|
+
row += 1
|
66
|
+
@tty.assert_row(row, 'hello')
|
67
|
+
row += 1
|
68
|
+
|
69
|
+
# midline backspace
|
70
|
+
assert_check_new_row(row)
|
71
|
+
@tty.send_keys(%(lsssss))
|
72
|
+
@tty.assert_cursor_position(START_COL + 6, row)
|
73
|
+
@tty.send_left_arrows(2)
|
74
|
+
@tty.assert_cursor_position(START_COL + 4, row)
|
75
|
+
@tty.send_backspaces(4)
|
76
|
+
@tty.assert_cursor_position(START_COL, row)
|
77
|
+
@tty.assert_row_ends_with(row, '$ ss')
|
78
|
+
@tty.send_right_arrows(2)
|
79
|
+
@tty.assert_cursor_position(START_COL + 2, row)
|
80
|
+
@tty.send_backspaces(2)
|
81
|
+
@tty.assert_cursor_position(START_COL, row)
|
82
|
+
@tty.send_keys(%(echo hello)) # make sure buffer is properly formed after backspaces
|
83
|
+
@tty.send_newline
|
84
|
+
row += 1
|
85
|
+
@tty.assert_row(row, 'hello')
|
@@ -1,80 +1,80 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# example testing a canonical shell called shl
|
5
|
-
|
6
|
-
require 'ttytest'
|
7
|
-
|
8
|
-
START_COL = 19
|
9
|
-
|
10
|
-
def assert_check_new_row(row)
|
11
|
-
@tty.assert_row_starts_with(row, "#{ENV['USER']}:")
|
12
|
-
@tty.assert_row_like(row, 'shl')
|
13
|
-
@tty.assert_row_ends_with(row, '$')
|
14
|
-
@tty.assert_cursor_position(START_COL, row)
|
15
|
-
end
|
16
|
-
|
17
|
-
@tty = TTYtest.new_terminal(%(PS1='$ ' ./bin/shl), width: 80, height: 24)
|
18
|
-
|
19
|
-
row = 0
|
20
|
-
|
21
|
-
@tty.assert_row_starts_with(row, 'shl: startup time: ')
|
22
|
-
row += 1
|
23
|
-
|
24
|
-
assert_check_new_row(row)
|
25
|
-
@tty.send_keys_one_at_a_time(%(ls))
|
26
|
-
@tty.assert_cursor_position(START_COL + 2, 1)
|
27
|
-
@tty.send_newline
|
28
|
-
@tty.assert_row_ends_with(row, 'ls')
|
29
|
-
row += 1
|
30
|
-
@tty.assert_row_starts_with(row, 'LICENSE')
|
31
|
-
row = 9
|
32
|
-
|
33
|
-
assert_check_new_row(row)
|
34
|
-
@tty.send_keys_one_at_a_time(%(echo hello))
|
35
|
-
@tty.send_newline
|
36
|
-
row += 1
|
37
|
-
@tty.assert_row(row, 'hello')
|
38
|
-
row += 1
|
39
|
-
|
40
|
-
assert_check_new_row(row)
|
41
|
-
@tty.send_keys_one_at_a_time(%(lss)) # send a bad command
|
42
|
-
@tty.send_newline
|
43
|
-
row += 1
|
44
|
-
@tty.assert_row(row, 'shl: Could not find command or directory: No such file or directory')
|
45
|
-
row += 1
|
46
|
-
|
47
|
-
# end of line backspace
|
48
|
-
assert_check_new_row(row)
|
49
|
-
@tty.send_keys_one_at_a_time(%(l))
|
50
|
-
@tty.send_backspace
|
51
|
-
assert_check_new_row(row)
|
52
|
-
|
53
|
-
# multiple end of line backspaces
|
54
|
-
@tty.send_keys_one_at_a_time(%(lsssss))
|
55
|
-
@tty.send_backspaces(4)
|
56
|
-
@tty.assert_row_ends_with(row, '$ ls')
|
57
|
-
@tty.send_backspaces(2)
|
58
|
-
@tty.send_keys_one_at_a_time(%(echo hello)) # make sure buffer is properly formed after backspaces
|
59
|
-
@tty.send_newline
|
60
|
-
row += 1
|
61
|
-
@tty.assert_row(row, 'hello')
|
62
|
-
row += 1
|
63
|
-
|
64
|
-
# midline backspace
|
65
|
-
assert_check_new_row(row)
|
66
|
-
@tty.send_keys_one_at_a_time(%(lsssss))
|
67
|
-
@tty.assert_cursor_position(START_COL + 6, row)
|
68
|
-
@tty.send_left_arrows(2)
|
69
|
-
@tty.assert_cursor_position(START_COL + 4, row)
|
70
|
-
@tty.send_backspaces(4)
|
71
|
-
@tty.assert_cursor_position(START_COL, row)
|
72
|
-
@tty.assert_row_ends_with(row, '$ ss')
|
73
|
-
@tty.send_right_arrows(2)
|
74
|
-
@tty.assert_cursor_position(START_COL + 2, row)
|
75
|
-
@tty.send_backspaces(2)
|
76
|
-
@tty.assert_cursor_position(START_COL, row)
|
77
|
-
@tty.send_keys_one_at_a_time(%(echo hello)) # make sure buffer is properly formed after backspaces
|
78
|
-
@tty.send_newline
|
79
|
-
row += 1
|
80
|
-
@tty.assert_row(row, 'hello')
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# example testing a canonical shell called shl
|
5
|
+
|
6
|
+
require 'ttytest'
|
7
|
+
|
8
|
+
START_COL = 19
|
9
|
+
|
10
|
+
def assert_check_new_row(row)
|
11
|
+
@tty.assert_row_starts_with(row, "#{ENV['USER']}:")
|
12
|
+
@tty.assert_row_like(row, 'shl')
|
13
|
+
@tty.assert_row_ends_with(row, '$')
|
14
|
+
@tty.assert_cursor_position(START_COL, row)
|
15
|
+
end
|
16
|
+
|
17
|
+
@tty = TTYtest.new_terminal(%(PS1='$ ' ./bin/shl), width: 80, height: 24)
|
18
|
+
|
19
|
+
row = 0
|
20
|
+
|
21
|
+
@tty.assert_row_starts_with(row, 'shl: startup time: ')
|
22
|
+
row += 1
|
23
|
+
|
24
|
+
assert_check_new_row(row)
|
25
|
+
@tty.send_keys_one_at_a_time(%(ls))
|
26
|
+
@tty.assert_cursor_position(START_COL + 2, 1)
|
27
|
+
@tty.send_newline
|
28
|
+
@tty.assert_row_ends_with(row, 'ls')
|
29
|
+
row += 1
|
30
|
+
@tty.assert_row_starts_with(row, 'LICENSE')
|
31
|
+
row = 9
|
32
|
+
|
33
|
+
assert_check_new_row(row)
|
34
|
+
@tty.send_keys_one_at_a_time(%(echo hello))
|
35
|
+
@tty.send_newline
|
36
|
+
row += 1
|
37
|
+
@tty.assert_row(row, 'hello')
|
38
|
+
row += 1
|
39
|
+
|
40
|
+
assert_check_new_row(row)
|
41
|
+
@tty.send_keys_one_at_a_time(%(lss)) # send a bad command
|
42
|
+
@tty.send_newline
|
43
|
+
row += 1
|
44
|
+
@tty.assert_row(row, 'shl: Could not find command or directory: No such file or directory')
|
45
|
+
row += 1
|
46
|
+
|
47
|
+
# end of line backspace
|
48
|
+
assert_check_new_row(row)
|
49
|
+
@tty.send_keys_one_at_a_time(%(l))
|
50
|
+
@tty.send_backspace
|
51
|
+
assert_check_new_row(row)
|
52
|
+
|
53
|
+
# multiple end of line backspaces
|
54
|
+
@tty.send_keys_one_at_a_time(%(lsssss))
|
55
|
+
@tty.send_backspaces(4)
|
56
|
+
@tty.assert_row_ends_with(row, '$ ls')
|
57
|
+
@tty.send_backspaces(2)
|
58
|
+
@tty.send_keys_one_at_a_time(%(echo hello)) # make sure buffer is properly formed after backspaces
|
59
|
+
@tty.send_newline
|
60
|
+
row += 1
|
61
|
+
@tty.assert_row(row, 'hello')
|
62
|
+
row += 1
|
63
|
+
|
64
|
+
# midline backspace
|
65
|
+
assert_check_new_row(row)
|
66
|
+
@tty.send_keys_one_at_a_time(%(lsssss))
|
67
|
+
@tty.assert_cursor_position(START_COL + 6, row)
|
68
|
+
@tty.send_left_arrows(2)
|
69
|
+
@tty.assert_cursor_position(START_COL + 4, row)
|
70
|
+
@tty.send_backspaces(4)
|
71
|
+
@tty.assert_cursor_position(START_COL, row)
|
72
|
+
@tty.assert_row_ends_with(row, '$ ss')
|
73
|
+
@tty.send_right_arrows(2)
|
74
|
+
@tty.assert_cursor_position(START_COL + 2, row)
|
75
|
+
@tty.send_backspaces(2)
|
76
|
+
@tty.assert_cursor_position(START_COL, row)
|
77
|
+
@tty.send_keys_one_at_a_time(%(echo hello)) # make sure buffer is properly formed after backspaces
|
78
|
+
@tty.send_newline
|
79
|
+
row += 1
|
80
|
+
@tty.assert_row(row, 'hello')
|
data/lib/ttytest/capture.rb
CHANGED
@@ -1,64 +1,64 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TTYtest
|
4
|
-
# Represents the complete state of a {TTYtest::Terminal} at the time it was captured (contents, cursor position, etc).
|
5
|
-
# @attr_reader [Integer] width the number of columns in the captured terminal
|
6
|
-
# @attr_reader [Integer] height the number of rows in the captured terminal
|
7
|
-
# @attr_reader [Integer] cursor_x the cursor's column (starting at 0) in the captured terminal
|
8
|
-
# @attr_reader [Integer] cursor_y the cursor's row (starting at 0) in the captured terminal
|
9
|
-
class Capture
|
10
|
-
include TTYtest::Matchers
|
11
|
-
|
12
|
-
attr_reader :cursor_x, :cursor_y, :width, :height
|
13
|
-
|
14
|
-
# Used internally by drivers when called by {Terminal#capture}
|
15
|
-
# @api private
|
16
|
-
def initialize(contents, cursor_x: 0, cursor_y: 0, width: nil, height: nil, cursor_visible: true)
|
17
|
-
@rows = "#{contents}\nEND".split("\n")[0...-1].map do |row|
|
18
|
-
row || ''
|
19
|
-
end
|
20
|
-
@cursor_x = cursor_x
|
21
|
-
@cursor_y = cursor_y
|
22
|
-
@width = width
|
23
|
-
@height = height
|
24
|
-
@cursor_visible = cursor_visible
|
25
|
-
end
|
26
|
-
|
27
|
-
# @return [Array<String>] An array of each row's contend from the captured terminal
|
28
|
-
attr_reader :rows
|
29
|
-
|
30
|
-
# @param [Integer] the row to return
|
31
|
-
# @return [String] the content of the row from the captured terminal
|
32
|
-
def row(row_number)
|
33
|
-
rows[row_number]
|
34
|
-
end
|
35
|
-
|
36
|
-
# @return [true,false] Whether the cursor is visible in the captured terminal
|
37
|
-
def cursor_visible?
|
38
|
-
@cursor_visible
|
39
|
-
end
|
40
|
-
|
41
|
-
# @return [true,false] Whether the cursor is hidden in the captured terminal
|
42
|
-
def cursor_hidden?
|
43
|
-
!cursor_visible?
|
44
|
-
end
|
45
|
-
|
46
|
-
# @return [Capture] returns self
|
47
|
-
def capture
|
48
|
-
self
|
49
|
-
end
|
50
|
-
|
51
|
-
def print
|
52
|
-
puts "\n#{self}"
|
53
|
-
end
|
54
|
-
|
55
|
-
def print_rows
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
# @return [String] All rows of the captured terminal, separated by newlines
|
60
|
-
def to_s
|
61
|
-
rows.join("\n")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TTYtest
|
4
|
+
# Represents the complete state of a {TTYtest::Terminal} at the time it was captured (contents, cursor position, etc).
|
5
|
+
# @attr_reader [Integer] width the number of columns in the captured terminal
|
6
|
+
# @attr_reader [Integer] height the number of rows in the captured terminal
|
7
|
+
# @attr_reader [Integer] cursor_x the cursor's column (starting at 0) in the captured terminal
|
8
|
+
# @attr_reader [Integer] cursor_y the cursor's row (starting at 0) in the captured terminal
|
9
|
+
class Capture
|
10
|
+
include TTYtest::Matchers
|
11
|
+
|
12
|
+
attr_reader :cursor_x, :cursor_y, :width, :height
|
13
|
+
|
14
|
+
# Used internally by drivers when called by {Terminal#capture}
|
15
|
+
# @api private
|
16
|
+
def initialize(contents, cursor_x: 0, cursor_y: 0, width: nil, height: nil, cursor_visible: true)
|
17
|
+
@rows = "#{contents}\nEND".split("\n")[0...-1].map do |row|
|
18
|
+
row || ''
|
19
|
+
end
|
20
|
+
@cursor_x = cursor_x
|
21
|
+
@cursor_y = cursor_y
|
22
|
+
@width = width
|
23
|
+
@height = height
|
24
|
+
@cursor_visible = cursor_visible
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Array<String>] An array of each row's contend from the captured terminal
|
28
|
+
attr_reader :rows
|
29
|
+
|
30
|
+
# @param [Integer] the row to return
|
31
|
+
# @return [String] the content of the row from the captured terminal
|
32
|
+
def row(row_number)
|
33
|
+
rows[row_number]
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [true,false] Whether the cursor is visible in the captured terminal
|
37
|
+
def cursor_visible?
|
38
|
+
@cursor_visible
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [true,false] Whether the cursor is hidden in the captured terminal
|
42
|
+
def cursor_hidden?
|
43
|
+
!cursor_visible?
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [Capture] returns self
|
47
|
+
def capture
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def print
|
52
|
+
puts "\n#{self}"
|
53
|
+
end
|
54
|
+
|
55
|
+
def print_rows
|
56
|
+
p rows
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [String] All rows of the captured terminal, separated by newlines
|
60
|
+
def to_s
|
61
|
+
rows.join("\n")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/ttytest/constants.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# some constants that can be used with send_keys, just to help out people creating tests
|
4
|
-
module TTYtest
|
5
|
-
BACKSPACE = 127.chr
|
6
|
-
TAB = 9.chr
|
7
|
-
CTRLF = 6.chr
|
8
|
-
CTRLC = 3.chr
|
9
|
-
CTRLD = '\004'
|
10
|
-
ESCAPE = 27.chr
|
11
|
-
|
12
|
-
UP_ARROW = "#{ESCAPE}[A".freeze
|
13
|
-
DOWN_ARROW = "#{ESCAPE}[B".freeze
|
14
|
-
RIGHT_ARROW = "#{ESCAPE}[C".freeze
|
15
|
-
LEFT_ARROW = "#{ESCAPE}[D".freeze
|
16
|
-
|
17
|
-
CLEAR = "#{ESCAPE}[2J".freeze
|
18
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# some constants that can be used with send_keys, just to help out people creating tests
|
4
|
+
module TTYtest
|
5
|
+
BACKSPACE = 127.chr
|
6
|
+
TAB = 9.chr
|
7
|
+
CTRLF = 6.chr
|
8
|
+
CTRLC = 3.chr
|
9
|
+
CTRLD = '\004'
|
10
|
+
ESCAPE = 27.chr
|
11
|
+
|
12
|
+
UP_ARROW = "#{ESCAPE}[A".freeze
|
13
|
+
DOWN_ARROW = "#{ESCAPE}[B".freeze
|
14
|
+
RIGHT_ARROW = "#{ESCAPE}[C".freeze
|
15
|
+
LEFT_ARROW = "#{ESCAPE}[D".freeze
|
16
|
+
|
17
|
+
CLEAR = "#{ESCAPE}[2J".freeze
|
18
|
+
end
|