judges 0.0.16 ā†’ 0.0.17

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: 583517ec65d24d9415fde952e8ce79daa7fc31662b72642c24e8bafcc211eea5
4
- data.tar.gz: 9ab9e0ecbf4f9adec75e07c19053e9c8c0dd28233af16dea85cee57db732fd75
3
+ metadata.gz: 7312c2f398cbad4906226fbc64c489a95428281003dcab21988185b214bea734
4
+ data.tar.gz: 7ecf453fcef5028bb43219ddfde277bd1e0e3633059afa69bafe895c8b9fa52a
5
5
  SHA512:
6
- metadata.gz: '07668e2dde2cfa7290b622e4a683796aaa7913a0591f84c64e4dd0eb5d46b9cd5c5a6e4088caa8f2025f28171aa93d1f44784b6366b63f5ac1da37814b8cc84b'
7
- data.tar.gz: 704b1c14632b39c402075fcb5f51c45711b5668a8e7b037b7a2d0a4b6ff209a55f687cdbfa5f0e7b646aefc08e0f17597089f2a632ef7dd89f4b7905782b4111
6
+ metadata.gz: 8000605816940bd197b284921b1a8218e51537c77f98fd7a932f5f47bac5c366dbe48fa3da0113dfa2db0c3760070d943a5d07a189f29ee87ddb3e0f6cedb18f
7
+ data.tar.gz: 9692dc49019dab0d0573cec9a95bbdd611328a7e2d95b3efc12ae5cc2e6a250d1ed2801d0c54b954872f53cf5d00139bf12c514612b8a86be72d18cf6dfd3d5e
data/bin/judges CHANGED
@@ -29,7 +29,7 @@ require 'factbase'
29
29
  Encoding.default_external = Encoding::UTF_8
30
30
  Encoding.default_internal = Encoding::UTF_8
31
31
 
32
- ver = '0.0.16'
32
+ ver = '0.0.17'
33
33
 
34
34
  include GLI::App
35
35
 
@@ -96,7 +96,9 @@ end
96
96
  desc 'Run automated tests for all judges'
97
97
  command :test do |c|
98
98
  c.desc 'Name of the test pack to run'
99
- c.flag([:pack], default_value: '')
99
+ c.flag([:pack], multiple: true)
100
+ c.desc 'Fail if no judges tested?'
101
+ c.flag([:quiet], default_value: false)
100
102
  c.action do |global, options, args|
101
103
  require_relative '../lib/judges/commands/test'
102
104
  Judges::Test.new(loog).run(options, args)
data/features/cli.feature CHANGED
@@ -27,14 +27,19 @@ Feature: Simple Run
27
27
 
28
28
  Scenario: Simple test of a few judges
29
29
  Given I run bin/judges with "test ./fixtures"
30
- Then Stdout contains "judges tested"
30
+ Then Stdout contains "šŸ‘‰ Testing"
31
+ Then Stdout contains "judges tested successfully"
31
32
  And Exit code is zero
32
33
 
33
34
  Scenario: Simple test of just one pack
34
- Given I run bin/judges with "test --pack absent_for_sure ./fixtures"
35
- Then Stdout contains "judges tested"
35
+ Given I run bin/judges with "test --pack reward_for_good_bug ./fixtures"
36
+ Then Stdout contains "judges tested successfully"
36
37
  And Exit code is zero
37
38
 
39
+ Scenario: Simple test of no packs
40
+ Given I run bin/judges with "test --pack absent_for_sure ./fixtures"
41
+ Then Exit code is not zero
42
+
38
43
  Scenario: Simple trimming of a factbase
39
44
  Given I make a temp directory
40
45
  Then I have a "simple/simple_judge.rb" file with content:
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.0.16'
29
+ s.version = '0.0.17'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description = '
@@ -42,8 +42,9 @@ class Judges::Test
42
42
  dir = args[0]
43
43
  @loog.info("Testing judges in #{dir.to_rel}...")
44
44
  errors = []
45
- done = Judges::Packs.new(dir, @loog).each_with_index do |p, i|
46
- next if !opts['pack'].nil? && p.name != opts['pack']
45
+ done = 0
46
+ Judges::Packs.new(dir, @loog).each_with_index do |p, i|
47
+ next unless include?(opts, p.name)
47
48
  @loog.info("\nšŸ‘‰ Testing #{p.script} (##{i}) in #{p.dir.to_rel}...")
48
49
  p.tests.each do |f|
49
50
  yaml = YAML.load_file(f, permitted_classes: [Time])
@@ -55,7 +56,9 @@ class Judges::Test
55
56
  errors << f
56
57
  end
57
58
  end
59
+ done += 1
58
60
  end
61
+ raise 'No judges tested :(' if done.zero? && !opts['quiet']
59
62
  if errors.empty?
60
63
  @loog.info("\nAll #{done} judges tested successfully")
61
64
  else
@@ -66,6 +69,12 @@ class Judges::Test
66
69
 
67
70
  private
68
71
 
72
+ def include?(opts, name)
73
+ packs = opts['pack'] || []
74
+ return true if packs.empty?
75
+ packs.include?(name)
76
+ end
77
+
69
78
  def test_one(pack, yaml)
70
79
  fb = Factbase.new
71
80
  yaml['input'].each do |i|
@@ -45,7 +45,7 @@ class TestTest < Minitest::Test
45
45
  - /fb/f[bar='4']
46
46
  YAML
47
47
  )
48
- Judges::Test.new(Loog::VERBOSE).run({}, [d])
48
+ Judges::Test.new(Loog::NULL).run({}, [d])
49
49
  end
50
50
  end
51
51
 
@@ -65,7 +65,7 @@ class TestTest < Minitest::Test
65
65
  YAML
66
66
  )
67
67
  assert_raises do
68
- Judges::Test.new(Loog::VERBOSE).run({}, [d])
68
+ Judges::Test.new(Loog::NULL).run({}, [d])
69
69
  end
70
70
  end
71
71
  end
@@ -84,7 +84,24 @@ class TestTest < Minitest::Test
84
84
  - /fb/f[foo='42']
85
85
  YAML
86
86
  )
87
- Judges::Test.new(Loog::VERBOSE).run({}, [d])
87
+ Judges::Test.new(Loog::NULL).run({}, [d])
88
+ end
89
+ end
90
+
91
+ def test_one_pack_negative
92
+ Dir.mktmpdir do |d|
93
+ File.write(File.join(d, 'foo.rb'), '')
94
+ File.write(
95
+ File.join(d, 'x.yml'),
96
+ <<-YAML
97
+ input: []
98
+ expected:
99
+ - /fb[count(f)=1]
100
+ YAML
101
+ )
102
+ assert_raises do
103
+ Judges::Test.new(Loog::NULL).run({ 'pack' => [File.basename(dir)] }, [d])
104
+ end
88
105
  end
89
106
  end
90
107
  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.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko