judges 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29aaf4f403a8df4007afa115bfbf0afd09f42ab8ad493536599944e84ed2b82e
4
- data.tar.gz: 5c5dc615c168c150c908589f0f775144d4117003129a07515dd252f2ba622c22
3
+ metadata.gz: 9ef24207b8d6248eb98283c45d490b6d8b74fd8c00a6ef8f81dffa546dd6d270
4
+ data.tar.gz: 856eeb0c1f19d4d28055880514aca057cb0ec7b8584898bb44c30e9382e5e139
5
5
  SHA512:
6
- metadata.gz: 642b71de17e43f5000b052dca656a3d374288f021f3fc1e7b75a7a095a50c9084ff3874e9c03bc954df8feb9eeac5482d5aaab35b869db6e879d2204a30e6427
7
- data.tar.gz: 146de657cb25b3e5ab88cf2444b6876c2dabc3be82eba3525a3c4115ede82dc366da5a51c6e9c32ea97aa3af57e6aab514756033d9e1cd3f9ad28b7ad23f99f9
6
+ metadata.gz: ca5c1ef2e4cd29c60a1b0c3eba7c9578f5ef7d835c70bfaa994f5a3adbb2b6d98a5dd1b96847a06ec9ab281991b7933db860b651f6f0c7df06aa1dceccc34092
7
+ data.tar.gz: f884e4007e22b4be4efb7513eb7101c4913071bfc916b80041109d62fa655ed48424aea3af351ce1976dfad198f6e5cd1495c3e13e2c0fcf574aa6ba225fae2e
data/Gemfile CHANGED
@@ -24,12 +24,12 @@ source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
26
  gem 'cucumber', '9.2.0', require: false
27
- gem 'minitest', '5.23.1', require: false
27
+ gem 'minitest', '5.24.0', require: false
28
28
  gem 'net-ping', '2.0.8', require: false
29
29
  gem 'rake', '13.2.1', require: false
30
- gem 'rspec-rails', '6.1.2', require: false
30
+ gem 'rspec-rails', '6.1.3', require: false
31
31
  gem 'rubocop', '1.64.1', require: false
32
- gem 'rubocop-performance', '1.21.0', require: false
32
+ gem 'rubocop-performance', '1.21.1', require: false
33
33
  gem 'rubocop-rspec', '3.0.1', require: false
34
34
  gem 'simplecov', '0.22.0', require: false
35
35
  gem 'simplecov-cobertura', '2.1.0', require: false
data/Gemfile.lock CHANGED
@@ -10,6 +10,7 @@ PATH
10
10
  loog (~> 0.2)
11
11
  moments (~> 0.3)
12
12
  nokogiri (~> 1.10)
13
+ others (~> 0.0)
13
14
  retries (~> 0.0)
14
15
  tago (~> 0.0)
15
16
  typhoeus (~> 1.3)
@@ -43,8 +44,8 @@ GEM
43
44
  minitest (>= 5.1)
44
45
  mutex_m
45
46
  tzinfo (~> 2.0)
46
- addressable (2.8.6)
47
- public_suffix (>= 2.0.2, < 6.0)
47
+ addressable (2.8.7)
48
+ public_suffix (>= 2.0.2, < 7.0)
48
49
  ast (2.4.2)
49
50
  backtrace (0.4.0)
50
51
  base64 (0.2.0)
@@ -77,20 +78,24 @@ GEM
77
78
  bigdecimal
78
79
  cucumber-gherkin (27.0.0)
79
80
  cucumber-messages (>= 19.1.4, < 23)
80
- cucumber-html-formatter (21.3.1)
81
+ cucumber-html-formatter (21.4.0)
81
82
  cucumber-messages (> 19, < 25)
82
83
  cucumber-messages (22.0.0)
83
84
  cucumber-tag-expressions (6.1.0)
85
+ decoor (0.0.1)
84
86
  diff-lcs (1.5.1)
85
87
  docile (1.4.0)
86
88
  drb (2.2.1)
87
- erubi (1.12.0)
89
+ erubi (1.13.0)
88
90
  ethon (0.16.0)
89
91
  ffi (>= 1.15.0)
90
- factbase (0.0.50)
92
+ factbase (0.0.54)
93
+ backtrace (~> 0.3)
94
+ decoor (~> 0.0)
91
95
  json (~> 2.7)
92
96
  loog (~> 0.2)
93
97
  nokogiri (~> 1.10)
98
+ others (~> 0.0)
94
99
  tago (~> 0.0)
95
100
  yaml (~> 0.3)
96
101
  ffi (1.17.0-aarch64-linux-gnu)
@@ -105,7 +110,7 @@ GEM
105
110
  i18n (1.14.5)
106
111
  concurrent-ruby (~> 1.0)
107
112
  io-console (0.7.2)
108
- irb (1.13.1)
113
+ irb (1.13.2)
109
114
  rdoc (>= 4.0.0)
110
115
  reline (>= 0.4.2)
111
116
  iri (0.8.0)
@@ -116,34 +121,35 @@ GEM
116
121
  nokogiri (>= 1.12.0)
117
122
  loog (0.5.1)
118
123
  mini_mime (1.1.5)
119
- minitest (5.23.1)
124
+ minitest (5.24.0)
120
125
  moments (0.3.0)
121
126
  multi_test (1.1.0)
122
127
  mutex_m (0.2.0)
123
128
  net-ping (2.0.8)
124
- nokogiri (1.16.5-aarch64-linux)
129
+ nokogiri (1.16.6-aarch64-linux)
125
130
  racc (~> 1.4)
126
- nokogiri (1.16.5-arm-linux)
131
+ nokogiri (1.16.6-arm-linux)
127
132
  racc (~> 1.4)
128
- nokogiri (1.16.5-arm64-darwin)
133
+ nokogiri (1.16.6-arm64-darwin)
129
134
  racc (~> 1.4)
130
- nokogiri (1.16.5-x64-mingw-ucrt)
135
+ nokogiri (1.16.6-x64-mingw-ucrt)
131
136
  racc (~> 1.4)
132
- nokogiri (1.16.5-x86-linux)
137
+ nokogiri (1.16.6-x86-linux)
133
138
  racc (~> 1.4)
134
- nokogiri (1.16.5-x86_64-darwin)
139
+ nokogiri (1.16.6-x86_64-darwin)
135
140
  racc (~> 1.4)
136
- nokogiri (1.16.5-x86_64-linux)
141
+ nokogiri (1.16.6-x86_64-linux)
137
142
  racc (~> 1.4)
143
+ others (0.0.3)
138
144
  parallel (1.25.1)
139
145
  parser (3.3.3.0)
140
146
  ast (~> 2.4.1)
141
147
  racc
142
148
  psych (5.1.2)
143
149
  stringio
144
- public_suffix (5.0.5)
150
+ public_suffix (6.0.0)
145
151
  racc (1.8.0)
146
- rack (3.1.3)
152
+ rack (3.1.4)
147
153
  rack-session (2.0.0)
148
154
  rack (>= 3.0.0)
149
155
  rack-test (2.1.0)
@@ -178,13 +184,13 @@ GEM
178
184
  strscan
179
185
  rspec-core (3.13.0)
180
186
  rspec-support (~> 3.13.0)
181
- rspec-expectations (3.13.0)
187
+ rspec-expectations (3.13.1)
182
188
  diff-lcs (>= 1.2.0, < 2.0)
183
189
  rspec-support (~> 3.13.0)
184
190
  rspec-mocks (3.13.1)
185
191
  diff-lcs (>= 1.2.0, < 2.0)
186
192
  rspec-support (~> 3.13.0)
187
- rspec-rails (6.1.2)
193
+ rspec-rails (6.1.3)
188
194
  actionpack (>= 6.1)
189
195
  activesupport (>= 6.1)
190
196
  railties (>= 6.1)
@@ -206,7 +212,7 @@ GEM
206
212
  unicode-display_width (>= 2.4.0, < 3.0)
207
213
  rubocop-ast (1.31.3)
208
214
  parser (>= 3.3.1.0)
209
- rubocop-performance (1.21.0)
215
+ rubocop-performance (1.21.1)
210
216
  rubocop (>= 1.48.1, < 2.0)
211
217
  rubocop-ast (>= 1.31.1, < 2.0)
212
218
  rubocop-rspec (3.0.1)
@@ -221,7 +227,7 @@ GEM
221
227
  simplecov (~> 0.19)
222
228
  simplecov-html (0.12.3)
223
229
  simplecov_json_formatter (0.1.4)
224
- stringio (3.1.0)
230
+ stringio (3.1.1)
225
231
  strscan (3.1.0)
226
232
  sys-uname (1.3.0)
227
233
  ffi (~> 1.1)
@@ -239,7 +245,7 @@ GEM
239
245
  webrick (1.8.1)
240
246
  yaml (0.3.0)
241
247
  yard (0.9.36)
242
- zeitwerk (2.6.15)
248
+ zeitwerk (2.6.16)
243
249
 
244
250
  PLATFORMS
245
251
  aarch64-linux
@@ -253,12 +259,12 @@ PLATFORMS
253
259
  DEPENDENCIES
254
260
  cucumber (= 9.2.0)
255
261
  judges!
256
- minitest (= 5.23.1)
262
+ minitest (= 5.24.0)
257
263
  net-ping (= 2.0.8)
258
264
  rake (= 13.2.1)
259
- rspec-rails (= 6.1.2)
265
+ rspec-rails (= 6.1.3)
260
266
  rubocop (= 1.64.1)
261
- rubocop-performance (= 1.21.0)
267
+ rubocop-performance (= 1.21.1)
262
268
  rubocop-rspec (= 3.0.1)
263
269
  simplecov (= 0.22.0)
264
270
  simplecov-cobertura (= 2.1.0)
data/bin/judges CHANGED
@@ -50,8 +50,8 @@ class App
50
50
  if global[:verbose]
51
51
  loog = Loog::VERBOSE
52
52
  end
53
- loog.debug("judges #{Judges::VERSION}")
54
- loog.debug("facbase #{Factbase::VERSION}")
53
+ loog.debug("Judges #{Judges::VERSION}")
54
+ loog.debug("Factbase #{Factbase::VERSION}")
55
55
  true
56
56
  end
57
57
 
@@ -142,7 +142,7 @@ class App
142
142
  c.desc 'Name of the judge to run (directory name)'
143
143
  c.flag([:judge], multiple: true)
144
144
  c.desc 'How many times to run?'
145
- c.flag([:runs], type: Integer, default_value: 1)
145
+ c.flag([:runs], type: Integer)
146
146
  c.desc 'The location of a Ruby library (directory with .rb files to include)'
147
147
  c.flag([:lib])
148
148
  c.desc 'Stay quiet even if some tests fail or simply no tests executed?'
@@ -47,7 +47,7 @@ Feature: Test
47
47
  Then Stdout contains "All 1 judge(s) and 1 tests passed"
48
48
  And Exit code is zero
49
49
 
50
- Scenario: Simple test with two runs
50
+ Scenario: Simple test with many runs
51
51
  Given I make a temp directory
52
52
  Then I have a "foo/simple.rb" file with content:
53
53
  """
@@ -57,10 +57,30 @@ Feature: Test
57
57
  Then I have a "foo/good.yml" file with content:
58
58
  """
59
59
  ---
60
- runs: 3
60
+ runs: 5
61
61
  input: []
62
62
  expected:
63
- - /fb/f[foo=count(/fb/f)]
63
+ - /fb[count(f)=5]
64
+ """
65
+ Then I run bin/judges with "test ."
66
+ Then Stdout contains "All 1 judge(s) and 1 tests passed"
67
+ And Exit code is zero
68
+
69
+ Scenario: Simple test with many runs and many asserts
70
+ Given I make a temp directory
71
+ Then I have a "foo/simple.rb" file with content:
72
+ """
73
+ n = $fb.insert
74
+ n.foo = $fb.size
75
+ """
76
+ Then I have a "foo/good.yml" file with content:
77
+ """
78
+ ---
79
+ runs: 5
80
+ input: []
81
+ assert_once: false
82
+ expected:
83
+ - /fb/f[foo = 1]
64
84
  """
65
85
  Then I run bin/judges with "test ."
66
86
  Then Stdout contains "All 1 judge(s) and 1 tests passed"
data/judges.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
27
27
  s.required_ruby_version = '>=3.2'
28
28
  s.name = 'judges'
29
- s.version = '0.9.0'
29
+ s.version = '0.11.0'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description =
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.add_runtime_dependency 'loog', '~>0.2'
51
51
  s.add_runtime_dependency 'moments', '~>0.3'
52
52
  s.add_runtime_dependency 'nokogiri', '~>1.10'
53
+ s.add_runtime_dependency 'others', '~>0.0'
53
54
  s.add_runtime_dependency 'retries', '~>0.0'
54
55
  s.add_runtime_dependency 'tago', '~>0.0'
55
56
  s.add_runtime_dependency 'typhoeus', '~>1.3'
@@ -122,11 +122,16 @@ class Judges::Test
122
122
  end
123
123
  end
124
124
  options = Judges::Options.new(opts['option']) + Judges::Options.new(yaml['options'])
125
- (1..(opts['runs'] || yaml['runs'] || 1)).each do
125
+ runs = opts['runs'] || yaml['runs'] || 1
126
+ (1..runs).each do |r|
126
127
  fbx = fb
127
128
  fbx = Factbase::Looged.new(fb, @loog) if opts['log']
128
129
  judge.run(fbx, {}, {}, options)
130
+ assert(judge, tname, fb, yaml) if r == runs || opts['assert_once'].is_a?(FalseClass)
129
131
  end
132
+ end
133
+
134
+ def assert(judge, tname, fb, yaml)
130
135
  xpaths = yaml['expected']
131
136
  return if xpaths.nil?
132
137
  xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
@@ -20,6 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
+ require 'others'
23
24
  require_relative '../judges'
24
25
 
25
26
  # Options for Ruby scripts in the judges.
@@ -54,7 +55,7 @@ class Judges::Options
54
55
  end
55
56
 
56
57
  # Get option by name.
57
- def method_missing(*args)
58
+ others do |*args|
58
59
  @hash ||= begin
59
60
  pp = @pairs || []
60
61
  pp = @pairs.map { |k, v| "#{k}=#{v}" } if pp.is_a?(Hash)
@@ -72,14 +73,4 @@ class Judges::Options
72
73
  k = args[0].downcase
73
74
  @hash[k]
74
75
  end
75
-
76
- # rubocop:disable Style/OptionalBooleanParameter
77
- def respond_to?(_method, _include_private = false)
78
- # rubocop:enable Style/OptionalBooleanParameter
79
- true
80
- end
81
-
82
- def respond_to_missing?(_method, _include_private = false)
83
- true
84
- end
85
76
  end
data/lib/judges.rb CHANGED
@@ -25,5 +25,5 @@
25
25
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Judges
28
- VERSION = '0.9.0'
28
+ VERSION = '0.11.0'
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-13 00:00:00.000000000 Z
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '1.10'
125
+ - !ruby/object:Gem::Dependency
126
+ name: others
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: retries
127
141
  requirement: !ruby/object:Gem::Requirement