judges 0.42.1 → 0.44.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/.github/workflows/eslint.yml +2 -3
- data/.github/workflows/markdown-lint.yml +1 -1
- data/.gitignore +1 -0
- data/Gemfile.lock +5 -3
- data/assets/index.js +3 -3
- data/bin/judges +49 -45
- data/features/import.feature +1 -1
- data/features/update.feature +5 -5
- data/judges.gemspec +1 -1
- data/lib/judges/commands/eval.rb +2 -2
- data/lib/judges/commands/import.rb +2 -2
- data/lib/judges/commands/inspect.rb +2 -2
- data/lib/judges/commands/join.rb +2 -2
- data/lib/judges/commands/print.rb +4 -3
- data/lib/judges/commands/pull.rb +5 -4
- data/lib/judges/commands/push.rb +3 -2
- data/lib/judges/commands/test.rb +2 -1
- data/lib/judges/commands/trim.rb +4 -3
- data/lib/judges/commands/update.rb +17 -3
- data/lib/judges/judge.rb +1 -1
- data/lib/judges.rb +1 -1
- data/package-lock.json +34 -915
- data/package.json +3 -2
- data/test/commands/test_update.rb +51 -0
- data/test/test__helper.rb +1 -1
- metadata +1 -1
data/package.json
CHANGED
@@ -141,4 +141,55 @@ class TestUpdate < Minitest::Test
|
|
141
141
|
assert_equal(3, sum['error'].size)
|
142
142
|
end
|
143
143
|
end
|
144
|
+
|
145
|
+
def test_fail_fast_stops_cycle
|
146
|
+
Dir.mktmpdir do |d|
|
147
|
+
save_it(File.join(d, 'error/error.rb'), 'invalid$ruby$syntax')
|
148
|
+
save_it(File.join(d, 'valid/valid.rb'), '$fb.insert')
|
149
|
+
file = File.join(d, 'base.fb')
|
150
|
+
Judges::Update.new(Loog::NULL).run(
|
151
|
+
{ 'fail-fast' => true, 'quiet' => true, 'max-cycles' => 3, 'boost' => 'error' },
|
152
|
+
[d, file]
|
153
|
+
)
|
154
|
+
fb = Factbase.new
|
155
|
+
fb.import(File.binread(file))
|
156
|
+
assert_equal(0, fb.size)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_fails_when_no_judges_used
|
161
|
+
assert_raises(StandardError) do
|
162
|
+
Dir.mktmpdir do |d|
|
163
|
+
save_it(File.join(d, 'foo/foo.rb'), '$fb.insert')
|
164
|
+
file = File.join(d, 'base.fb')
|
165
|
+
Judges::Update.new(Loog::NULL).run({ 'judge' => ['nonexistent'], 'expect-judges' => true }, [d, file])
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_fails_when_empty_directory
|
171
|
+
assert_raises(StandardError) do
|
172
|
+
Dir.mktmpdir do |d|
|
173
|
+
file = File.join(d, 'base.fb')
|
174
|
+
Judges::Update.new(Loog::NULL).run({ 'expect-judges' => true }, [d, file])
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_no_failure_when_expect_judges_false
|
180
|
+
Dir.mktmpdir do |d|
|
181
|
+
file = File.join(d, 'base.fb')
|
182
|
+
Judges::Update.new(Loog::NULL).run({ 'expect-judges' => false }, [d, file])
|
183
|
+
assert_path_exists(file)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_no_failure_with_nonexistent_judge_when_expect_judges_false
|
188
|
+
Dir.mktmpdir do |d|
|
189
|
+
save_it(File.join(d, 'foo/foo.rb'), '$fb.insert')
|
190
|
+
file = File.join(d, 'base.fb')
|
191
|
+
Judges::Update.new(Loog::NULL).run({ 'judge' => ['nonexistent'], 'expect-judges' => false }, [d, file])
|
192
|
+
assert_path_exists(file)
|
193
|
+
end
|
194
|
+
end
|
144
195
|
end
|
data/test/test__helper.rb
CHANGED