ttytest2 0.9.9 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ttytest/constants.rb +8 -4
- data/lib/ttytest/matchers.rb +14 -0
- data/lib/ttytest/terminal.rb +1 -1
- data/lib/ttytest/version.rb +1 -1
- data/notes.txt +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5b2fc10663d92fceff0b916a649e110960a154bcf293ced77a4720f5bbaf56c
|
4
|
+
data.tar.gz: '066281ff0a686fb4d1e44aff5019c36dfbecf493f6ea76b72347577b27764aff'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99393d6258719b1e56f7177bc646800dffa6249281a119a4e2e72ea5069f52873f269d195246d203e0daa67e60c7800fb883c77e4c3343db8c1c6013b3c88bb8
|
7
|
+
data.tar.gz: 7d6059bae47250df596187405609974eebcd80af454969806be91df6c8fc350b373e931a1960bfcca37cf9864240406e3a9340385df50237be91e95419b6dd0a
|
data/lib/ttytest/constants.rb
CHANGED
@@ -2,17 +2,21 @@
|
|
2
2
|
|
3
3
|
# some constants that can be used with send_keys, just to help out people creating tests
|
4
4
|
module TTYtest
|
5
|
+
CTRLA = 1.chr
|
6
|
+
CTRLB = 2.chr
|
5
7
|
CTRLC = 3.chr
|
6
8
|
CTRLD = 4.chr
|
7
9
|
CTRLF = 6.chr
|
8
10
|
BELL = 7.chr
|
9
11
|
BACKSPACE = 8.chr
|
10
|
-
TAB = 9.chr
|
12
|
+
TAB = 9.chr # \t
|
11
13
|
NEWLINE = 10.chr # \n
|
12
|
-
VERTICAL_TAB = 11.chr
|
13
|
-
FORM_FEED = 12.chr
|
14
|
+
VERTICAL_TAB = 11.chr # \v
|
15
|
+
FORM_FEED = 12.chr # \f
|
14
16
|
CARRIAGE_RETURN = 13.chr # \r
|
15
|
-
|
17
|
+
CTRLU = 21.chr
|
18
|
+
CTRLW = 23.chr
|
19
|
+
ESCAPE = 27.chr # ^[ or /033 or /e
|
16
20
|
DELETE = 127.chr
|
17
21
|
|
18
22
|
UP_ARROW = "#{ESCAPE}[A".freeze
|
data/lib/ttytest/matchers.rb
CHANGED
@@ -73,6 +73,20 @@ module TTYtest
|
|
73
73
|
"expected row #{row_number} to end with #{expected.inspect} and got #{actual.inspect}\nEntire screen:\n#{self}"
|
74
74
|
end
|
75
75
|
|
76
|
+
# Asserts the contents of a single row match against the passed in regular expression
|
77
|
+
# @param [Integer] row_number the row (starting from 0) to test against
|
78
|
+
# @param [String] regexp_str the regular expression as a string that will be used to match with.
|
79
|
+
# @raise [MatchError] if the row doesn't match against the regular expression
|
80
|
+
def assert_row_regexp(row_number, regexp_str)
|
81
|
+
regexp = Regexp.new(regexp_str)
|
82
|
+
actual = row(row_number)
|
83
|
+
|
84
|
+
return if actual.match?(regexp)
|
85
|
+
|
86
|
+
raise MatchError,
|
87
|
+
"expected row #{row_number} to match regexp #{regexp_str} but it did not. Row value #{actual.inspect}\nEntire screen:\n#{self}"
|
88
|
+
end
|
89
|
+
|
76
90
|
# Asserts that the cursor is in the expected position
|
77
91
|
# @param [Integer] x cursor x (row) position, starting from 0
|
78
92
|
# @param [Integer] y cursor y (column) position, starting from 0
|
data/lib/ttytest/terminal.rb
CHANGED
@@ -116,7 +116,7 @@ module TTYtest
|
|
116
116
|
:cursor_x, :cursor_y,
|
117
117
|
:cursor_visible?, :cursor_hidden?
|
118
118
|
|
119
|
-
|
119
|
+
Matchers::METHODS.each do |matcher_name|
|
120
120
|
define_method matcher_name do |*args|
|
121
121
|
synchronize do
|
122
122
|
capture.public_send(matcher_name, *args)
|
data/lib/ttytest/version.rb
CHANGED
data/notes.txt
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttytest2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Eski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|