judges 0.51.0 → 0.52.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.
@@ -75,8 +75,12 @@ class TestPrint < Minitest::Test
75
75
  refute_empty(xml.xpath('/html'), xml)
76
76
  WebMock.enable_net_connect!
77
77
  skip('We are offline') unless online?
78
- v = W3CValidators::NuValidator.new.validate_file(html)
79
- assert_empty(v.errors, "#{doc}\n\n#{v.errors.join('; ')}")
78
+ begin
79
+ v = W3CValidators::NuValidator.new.validate_file(html)
80
+ assert_empty(v.errors, "#{doc}\n\n#{v.errors.join('; ')}")
81
+ rescue W3CValidators::ValidatorUnavailable
82
+ skip('Cloud validator is too busy')
83
+ end
80
84
  end
81
85
 
82
86
  def test_html_table_has_colgroup
@@ -161,4 +161,57 @@ class TestTest < Minitest::Test
161
161
  assert_path_exists(d)
162
162
  end
163
163
  end
164
+
165
+ def test_with_timeout_success
166
+ Dir.mktmpdir do |d|
167
+ save_it(File.join(d, 'foo/foo.rb'), '$fb.insert.foo = 42')
168
+ save_it(
169
+ File.join(d, 'foo/x.yml'),
170
+ <<-YAML
171
+ input: []
172
+ timeout: 5
173
+ expected:
174
+ - /fb[count(f)=1]
175
+ - /fb/f[foo='42']
176
+ YAML
177
+ )
178
+ Judges::Test.new(Loog::NULL).run({}, [d])
179
+ assert_path_exists(d)
180
+ end
181
+ end
182
+
183
+ def test_with_timeout_failure
184
+ Dir.mktmpdir do |d|
185
+ save_it(File.join(d, 'foo/foo.rb'), 'sleep(10)')
186
+ save_it(
187
+ File.join(d, 'foo/x.yml'),
188
+ <<-YAML
189
+ input: []
190
+ timeout: 1
191
+ YAML
192
+ )
193
+ assert_raises(StandardError) do
194
+ Judges::Test.new(Loog::NULL).run({}, [d])
195
+ end
196
+ end
197
+ end
198
+
199
+ def test_with_timeout_in_after_script
200
+ Dir.mktmpdir do |d|
201
+ save_it(File.join(d, 'foo/foo.rb'), '$fb.insert.foo = 42')
202
+ save_it(File.join(d, 'foo/assert.rb'), 'sleep(10)')
203
+ save_it(
204
+ File.join(d, 'foo/x.yml'),
205
+ <<-YAML
206
+ input: []
207
+ timeout: 1
208
+ after:
209
+ - assert.rb
210
+ YAML
211
+ )
212
+ assert_raises(StandardError) do
213
+ Judges::Test.new(Loog::NULL).run({}, [d])
214
+ end
215
+ end
216
+ end
164
217
  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.51.0
4
+ version: 0.52.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko