judges 0.9.0 → 0.10.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: a66536b050bc10aad0401eece9025c2cca7cc98862b18fd8fc31be03a390c8b9
4
+ data.tar.gz: 022e2a420efcfd08c7df9690f81dba7490fcbc1b9c16fe5991224140fa843d67
5
5
  SHA512:
6
- metadata.gz: 642b71de17e43f5000b052dca656a3d374288f021f3fc1e7b75a7a095a50c9084ff3874e9c03bc954df8feb9eeac5482d5aaab35b869db6e879d2204a30e6427
7
- data.tar.gz: 146de657cb25b3e5ab88cf2444b6876c2dabc3be82eba3525a3c4115ede82dc366da5a51c6e9c32ea97aa3af57e6aab514756033d9e1cd3f9ad28b7ad23f99f9
6
+ metadata.gz: 928a033f2853602094977d119c30f0a64516f4548e4c776540b9861bcf1792b96100947d6d36d4e971468ce314434dd46c2e0e0ba033a11fed5fccb02f879928
7
+ data.tar.gz: 7a47a73a1627723225d93c98d1ba3391bb27c20322411ffe55dfc21f4ee176578fb42e8c62e47b1efa87faa1e5160df5a28fe52f046ecaf197458fa49208d6a7
data/bin/judges CHANGED
@@ -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.10.0'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description =
@@ -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)
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.10.0'
29
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko