judges 0.32.0 → 0.34.0
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/.rubocop.yml +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/REUSE.toml +4 -0
- data/features/test.feature +1 -1
- data/fixtures/repeat/repeat.rb +6 -0
- data/fixtures/repeat/repeated.yml +9 -0
- data/judges.gemspec +1 -1
- data/lib/judges/commands/test.rb +24 -8
- data/lib/judges.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e26309233bda6e09c9673cc9b17b3a6309897e2e2a19505288889fe947af3d7
|
4
|
+
data.tar.gz: 895a20352dd34b430f3001de0ba8c5eb97e0f1fd2de77386ad63d9282831e021
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bb06d82f69a67972774c2a7ef92bfc1655bcd30f4c162cae6d1669192725a3e7fc28efecaab9fda0bf3ac4a31b84725412248009ff22a7c77e289ae0699947c
|
7
|
+
data.tar.gz: 621ea22a9b604c2433e07ff6a5c241c86d8559de17b59def8d2878477fe5c4340a565090daa38770b054d81960ec45250db10282dd356b05367397fba066e65c
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -40,6 +40,7 @@ before:
|
|
40
40
|
category: slow
|
41
41
|
runs: 1
|
42
42
|
skip: false
|
43
|
+
repeat: 20
|
43
44
|
input:
|
44
45
|
-
|
45
46
|
foo: 42
|
@@ -65,6 +66,9 @@ when the test is finished.
|
|
65
66
|
The `category` (default: `[]`) may have one or an array of categories,
|
66
67
|
which then may be turned on via the `--category` command line flag.
|
67
68
|
|
69
|
+
The `repeat` (default: `1`) makes `input` to be repeated multiple times
|
70
|
+
(mostly useful for speed measuring on big data inputs).
|
71
|
+
|
68
72
|
The `runs` (default: `1`) is the number of times the `.rb` script should
|
69
73
|
be executed. After each execution, all expected XPath expressions are validated.
|
70
74
|
|
data/REUSE.toml
CHANGED
@@ -4,13 +4,17 @@
|
|
4
4
|
version = 1
|
5
5
|
[[annotations]]
|
6
6
|
path = [
|
7
|
+
"**/*.csv",
|
7
8
|
"**/*.jpg",
|
8
9
|
"**/*.json",
|
9
10
|
"**/*.md",
|
10
11
|
"**/*.pdf",
|
11
12
|
"**/*.png",
|
12
13
|
"**/*.svg",
|
14
|
+
"**/*.txt",
|
15
|
+
"**/*.vm",
|
13
16
|
"**/.gitignore",
|
17
|
+
"**/CNAME",
|
14
18
|
".gitattributes",
|
15
19
|
".gitignore",
|
16
20
|
".gitleaksignore",
|
data/features/test.feature
CHANGED
@@ -7,7 +7,7 @@ Feature: Test
|
|
7
7
|
Scenario: Simple test of a few judges
|
8
8
|
Given I run bin/judges with "test ./fixtures"
|
9
9
|
Then Stdout contains "👉 Testing"
|
10
|
-
Then Stdout contains "All
|
10
|
+
Then Stdout contains "All 3 judge(s) and 3 tests passed"
|
11
11
|
And Exit code is zero
|
12
12
|
|
13
13
|
Scenario: Simple test of just one judge
|
data/judges.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
10
10
|
s.required_ruby_version = '>=3.2'
|
11
11
|
s.name = 'judges'
|
12
|
-
s.version = '0.
|
12
|
+
s.version = '0.34.0'
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.summary = 'Command-Line Tool for a Factbase'
|
15
15
|
s.description =
|
data/lib/judges/commands/test.rb
CHANGED
@@ -39,6 +39,7 @@ class Judges::Test
|
|
39
39
|
tested = 0
|
40
40
|
tests = 0
|
41
41
|
visible = []
|
42
|
+
times = {}
|
42
43
|
judges = Judges::Judges.new(dir, opts['lib'], @loog)
|
43
44
|
elapsed(@loog, level: Logger::INFO) do
|
44
45
|
judges.each_with_index do |judge, i|
|
@@ -67,7 +68,9 @@ class Judges::Test
|
|
67
68
|
@loog.info("Running #{j.script} judge as a pre-condition...")
|
68
69
|
test_one(fb, opts, j, n, yaml, assert: false)
|
69
70
|
end
|
71
|
+
start = Time.now
|
70
72
|
test_one(fb, opts, judge, tname, yaml)
|
73
|
+
times["#{judge.name}/#{tname}"] = Time.now - start
|
71
74
|
yaml['after']&.each do |rb|
|
72
75
|
@loog.info("Running #{rb} assertion script...")
|
73
76
|
$fb = fb
|
@@ -82,6 +85,17 @@ class Judges::Test
|
|
82
85
|
end
|
83
86
|
tested += 1
|
84
87
|
end
|
88
|
+
unless times.empty?
|
89
|
+
fmt = "%60s\t%9s"
|
90
|
+
@loog.info(
|
91
|
+
[
|
92
|
+
'Time summaries:',
|
93
|
+
format(fmt, 'Script', 'Seconds'),
|
94
|
+
format(fmt, '---', '---'),
|
95
|
+
times.map { |script, sec| format(fmt, script, format('%.3f', sec)) }.join("\n ")
|
96
|
+
].join("\n ")
|
97
|
+
)
|
98
|
+
end
|
85
99
|
throw :'👍 No judges tested' if tested.zero?
|
86
100
|
throw :"👍 All #{tested} judge(s) but no tests passed" if tests.zero?
|
87
101
|
throw :"👍 All #{tested} judge(s) and #{tests} tests passed" if errors.empty?
|
@@ -112,15 +126,17 @@ class Judges::Test
|
|
112
126
|
|
113
127
|
def prepare(fb, yaml)
|
114
128
|
inputs = yaml['input']
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
vv.
|
120
|
-
|
129
|
+
(yaml['repeat']&.to_i || 1).times do
|
130
|
+
inputs&.each do |i|
|
131
|
+
f = fb.insert
|
132
|
+
i.each do |k, vv|
|
133
|
+
if vv.is_a?(Array)
|
134
|
+
vv.each do |v|
|
135
|
+
f.send(:"#{k}=", v)
|
136
|
+
end
|
137
|
+
else
|
138
|
+
f.send(:"#{k}=", vv)
|
121
139
|
end
|
122
|
-
else
|
123
|
-
f.send(:"#{k}=", vv)
|
124
140
|
end
|
125
141
|
end
|
126
142
|
end
|
data/lib/judges.rb
CHANGED
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.
|
4
|
+
version: 0.34.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: 2025-02-
|
11
|
+
date: 2025-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -272,6 +272,8 @@ files:
|
|
272
272
|
- fixtures/guess/guess.rb
|
273
273
|
- fixtures/guess/guess_made.yml
|
274
274
|
- fixtures/guess/skipped.yml
|
275
|
+
- fixtures/repeat/repeat.rb
|
276
|
+
- fixtures/repeat/repeated.yml
|
275
277
|
- fixtures/try/tried.yml
|
276
278
|
- fixtures/try/try.rb
|
277
279
|
- judges.gemspec
|