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 +4 -4
- data/bin/judges +1 -1
- data/features/test.feature +23 -3
- data/judges.gemspec +1 -1
- data/lib/judges/commands/test.rb +6 -1
- data/lib/judges.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a66536b050bc10aad0401eece9025c2cca7cc98862b18fd8fc31be03a390c8b9
|
4
|
+
data.tar.gz: 022e2a420efcfd08c7df9690f81dba7490fcbc1b9c16fe5991224140fa843d67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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?'
|
data/features/test.feature
CHANGED
@@ -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
|
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:
|
60
|
+
runs: 5
|
61
61
|
input: []
|
62
62
|
expected:
|
63
|
-
- /fb
|
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.
|
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 =
|
data/lib/judges/commands/test.rb
CHANGED
@@ -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
|
-
|
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