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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 255274128343764bc7bfcd600e925ba0e84b3c36d79550205890e9583b34723f
4
- data.tar.gz: bcfce7f61108dc09ea83baacc27a6dbc2f416fae5b90663859e665887e6d9ed6
3
+ metadata.gz: f5b2fc10663d92fceff0b916a649e110960a154bcf293ced77a4720f5bbaf56c
4
+ data.tar.gz: '066281ff0a686fb4d1e44aff5019c36dfbecf493f6ea76b72347577b27764aff'
5
5
  SHA512:
6
- metadata.gz: d9e355e8958e8336e9b76cc976728faf511e1edd3b7cf6774613e3d62c12d93192bb8a1a6f9881d8a63343fdd213050fad6e86e7e37d6cfe20757e3c4f564763
7
- data.tar.gz: ff23c17d5fe7b11dd4ca7b0405d647de1e5309c32f9e3f65b98ade66d2aeed5ba5925f959e91af88a2a8e3c0af95e8228592a41af7ead7dc3fe0a8ecc4979e6b
6
+ metadata.gz: 99393d6258719b1e56f7177bc646800dffa6249281a119a4e2e72ea5069f52873f269d195246d203e0daa67e60c7800fb883c77e4c3343db8c1c6013b3c88bb8
7
+ data.tar.gz: 7d6059bae47250df596187405609974eebcd80af454969806be91df6c8fc350b373e931a1960bfcca37cf9864240406e3a9340385df50237be91e95419b6dd0a
@@ -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
- ESCAPE = 27.chr # ^[ or /033
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
@@ -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
@@ -116,7 +116,7 @@ module TTYtest
116
116
  :cursor_x, :cursor_y,
117
117
  :cursor_visible?, :cursor_hidden?
118
118
 
119
- TTYtest::Matchers::METHODS.each do |matcher_name|
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TTYtest
4
- VERSION = '0.9.9'
4
+ VERSION = '0.9.10'
5
5
  end
data/notes.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  to push new version to github
2
- git tag v0.9.9
2
+ git tag v0.9.10
3
3
  git push origin --tags
4
4
 
5
5
  to push new version to rubygems.org
6
6
  gem build ttytest2.gemspec
7
- gem push ttytest2-0.9.9.gem
7
+ gem push ttytest2-0.9.10.gem
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.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-20 00:00:00.000000000 Z
11
+ date: 2024-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler