judges 0.0.31 → 0.0.33

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: 1c9e50999193ddf009d02379799add455856fae20b4f47e67a1760d56d7de3b0
4
- data.tar.gz: af70fa8273042c07df059589181795769518c94d54c4430cf9fe9d2999da799a
3
+ metadata.gz: 9cdbff8b28d803f0ce0c0c8e8a934ea9af5b6d65b6396f04f94572bc21bb515e
4
+ data.tar.gz: 856504a44bf49b36ee64f3d304d14861965682df9257b6bbdb1284b71330d32d
5
5
  SHA512:
6
- metadata.gz: ce9ee17c4b5cf1aadc125678bde1e0a7b4bd07a6e1cb2e54696e5e478a68371f9e4c7a6c18f7961be77f056903a1e49eb943d4c9d949fedb96db71ed2f23350e
7
- data.tar.gz: fbadf8ca9127b21114b483b7a7f5e6b109d8c804f101a27fe6140c6a77e68a0f522bda5b32a366415b946d1c59c01130ab509a22e9f5c95037dbf605414d7667
6
+ metadata.gz: ddb58a1c8443ed4d61c3f55d155c34f0ba9e164d731167e7069169ac3ee7dbe9734fd7c4bd5a9e90a98787136b43d44966a3662fe3d13014298dcf1e770dd5d4
7
+ data.tar.gz: 9c8fe18c4bebae1ceeb56611b71862d5cda792d292e6ba33f6f1e6b0700483ab385281d00e6ca1a5f3e134d644f065706e547cc3d9b56c4e634dd7c46afac0dd
@@ -0,0 +1,57 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: license
22
+ 'on':
23
+ push:
24
+ branches:
25
+ - master
26
+ pull_request:
27
+ branches:
28
+ - master
29
+ jobs:
30
+ license:
31
+ runs-on: ubuntu-22.04
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - shell: bash
35
+ run: |
36
+ header="Copyright (c) $(date +%Y) Yegor Bugayenko"
37
+ failed="false"
38
+ while IFS= read -r file; do
39
+ if ! grep -q "${header}" "${file}"; then
40
+ failed="true"
41
+ echo "⚠️ Copyright header is not found in: ${file}"
42
+ else
43
+ echo "File looks good: ${file}"
44
+ fi
45
+ done < <(find . -type f \( \
46
+ -name "Dockerfile" -o \
47
+ -name "LICENSE.txt" -o \
48
+ -name "Makefile" -o \
49
+ -name "Rakefile" -o \
50
+ -name "*.sh" -o \
51
+ -name "*.rb" -o \
52
+ -name "*.fe" -o \
53
+ -name "*.yml" \
54
+ \) -print)
55
+ if [ "${failed}" = "true" ]; then
56
+ exit 1
57
+ fi
data/Gemfile CHANGED
@@ -24,10 +24,10 @@ source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
26
  gem 'cucumber', '9.2.0', require: false
27
- gem 'minitest', '5.23.0', require: false
27
+ gem 'minitest', '5.23.1', require: false
28
28
  gem 'rake', '13.2.1', require: false
29
29
  gem 'rspec-rails', '6.1.2', require: false
30
- gem 'rubocop', '1.63.5', require: false
30
+ gem 'rubocop', '1.64.0', require: false
31
31
  gem 'rubocop-performance', '1.21.0', require: false
32
32
  gem 'rubocop-rspec', '2.29.2', require: false
33
33
  gem 'simplecov', '0.22.0', require: false
data/Gemfile.lock CHANGED
@@ -3,7 +3,7 @@ PATH
3
3
  specs:
4
4
  judges (0.0.0)
5
5
  backtrace (~> 0.3)
6
- factbase (~> 0.0.30)
6
+ factbase (~> 0.0.32)
7
7
  gli (~> 2.21)
8
8
  loog (~> 0.2)
9
9
  nokogiri (~> 1.10)
@@ -74,7 +74,7 @@ GEM
74
74
  docile (1.4.0)
75
75
  drb (2.2.1)
76
76
  erubi (1.12.0)
77
- factbase (0.0.30)
77
+ factbase (0.0.32)
78
78
  json (~> 2.7)
79
79
  loog (~> 0.2)
80
80
  nokogiri (~> 1.10)
@@ -95,7 +95,7 @@ GEM
95
95
  nokogiri (>= 1.12.0)
96
96
  loog (0.5.1)
97
97
  mini_mime (1.1.5)
98
- minitest (5.23.0)
98
+ minitest (5.23.1)
99
99
  multi_test (1.1.0)
100
100
  mutex_m (0.2.0)
101
101
  nokogiri (1.16.5-arm64-darwin)
@@ -138,7 +138,7 @@ GEM
138
138
  zeitwerk (~> 2.6)
139
139
  rainbow (3.1.1)
140
140
  rake (13.2.1)
141
- rdoc (6.6.3.1)
141
+ rdoc (6.7.0)
142
142
  psych (>= 4.0.0)
143
143
  regexp_parser (2.9.2)
144
144
  reline (0.5.7)
@@ -162,7 +162,7 @@ GEM
162
162
  rspec-mocks (~> 3.13)
163
163
  rspec-support (~> 3.13)
164
164
  rspec-support (3.13.1)
165
- rubocop (1.63.5)
165
+ rubocop (1.64.0)
166
166
  json (~> 2.3)
167
167
  language_server-protocol (>= 3.17.0)
168
168
  parallel (~> 1.10)
@@ -221,10 +221,10 @@ PLATFORMS
221
221
  DEPENDENCIES
222
222
  cucumber (= 9.2.0)
223
223
  judges!
224
- minitest (= 5.23.0)
224
+ minitest (= 5.23.1)
225
225
  rake (= 13.2.1)
226
226
  rspec-rails (= 6.1.2)
227
- rubocop (= 1.63.5)
227
+ rubocop (= 1.64.0)
228
228
  rubocop-performance (= 1.21.0)
229
229
  rubocop-rspec (= 2.29.2)
230
230
  simplecov (= 0.22.0)
data/bin/judges CHANGED
@@ -32,7 +32,7 @@ Encoding.default_internal = Encoding::UTF_8
32
32
  class App
33
33
  extend GLI::App
34
34
 
35
- ver = '0.0.31'
35
+ ver = '0.0.33'
36
36
 
37
37
  loog = Loog::REGULAR
38
38
 
@@ -98,9 +98,7 @@ class App
98
98
  desc 'Remove the facts that are too old'
99
99
  command :trim do |c|
100
100
  c.desc 'Only the facts that match the expression are deleted'
101
- c.flag([:query])
102
- c.desc 'Remove facts that are older than X days'
103
- c.flag([:days], type: Integer)
101
+ c.flag([:query], default_value: '(never)')
104
102
  c.action do |global, options, args|
105
103
  require_relative '../lib/judges/commands/trim'
106
104
  Judges::Trim.new(loog).run(options, args)
@@ -114,7 +112,7 @@ class App
114
112
  c.desc 'Generate output name of the file automatically'
115
113
  c.switch([:auto], default_value: false)
116
114
  c.desc 'Only the facts that match the expression are printed'
117
- c.flag([:query], default_value: '()')
115
+ c.flag([:query], default_value: '(always)')
118
116
  c.desc 'Print even if target file already exists and is older than the factbase'
119
117
  c.switch([:force], default_value: false)
120
118
  c.action do |global, options, args|
@@ -49,7 +49,7 @@ When(%r{^I run bin/judges with "([^"]*)"$}) do |arg|
49
49
  home = File.join(File.dirname(__FILE__), '../..')
50
50
  cmd = "ruby -I#{home}/lib #{home}/bin/judges #{arg}"
51
51
  cmd = "GLI_DEBUG=true #{cmd}" unless Gem.win_platform?
52
- @stdout = `#{cmd}`
52
+ @stdout = `#{cmd} 2>&1`
53
53
  @exitstatus = $CHILD_STATUS.exitstatus
54
54
  end
55
55
 
@@ -8,7 +8,7 @@ Feature: Test
8
8
  And Exit code is zero
9
9
 
10
10
  Scenario: Simple test of just one pack
11
- Given I run bin/judges with "test --pack reward_for_good_bug ./fixtures"
11
+ Given I run bin/judges with "test --pack guess ./fixtures"
12
12
  Then Stdout contains "judge(s) tested successfully"
13
13
  And Exit code is zero
14
14
 
@@ -1,17 +1,16 @@
1
1
  Feature: Trim
2
2
  I want to trim a factbase
3
3
 
4
- Scenario: Simple trimming of a factbase
4
+ Scenario: Simple trimming of a factbase, with a query
5
5
  Given I make a temp directory
6
- Then I run bin/judges with "--verbose eval simple.fb '$fb.insert.time = Time.now - 100 * 60 * 60 * 24'"
7
- Then I run bin/judges with "--verbose update . simple.fb"
8
- Given I run bin/judges with "trim --days 5 simple.fb"
6
+ Then I run bin/judges with "--verbose eval simple.fb '$fb.insert.foo = 42'"
7
+ Given I run bin/judges with "trim --query '(eq foo 42)' simple.fb"
9
8
  Then Stdout contains "1 fact(s) deleted"
10
9
  And Exit code is zero
11
10
 
12
- Scenario: Simple trimming of a factbase, with a query
11
+ Scenario: Delete nothing by default
13
12
  Given I make a temp directory
14
13
  Then I run bin/judges with "--verbose eval simple.fb '$fb.insert.foo = 42'"
15
- Given I run bin/judges with "trim --query '(eq foo 42)' simple.fb"
16
- Then Stdout contains "1 fact(s) deleted"
14
+ Given I run bin/judges with "trim simple.fb"
15
+ Then Stdout contains "No facts deleted"
17
16
  And Exit code is zero
@@ -30,3 +30,23 @@ Feature: Update
30
30
  Then Stdout contains "1 judge(s) processed"
31
31
  Then Stdout contains "Update finished: 1 cycles"
32
32
  And Exit code is zero
33
+
34
+ Scenario: The update fails when a bug in a judge
35
+ Given I make a temp directory
36
+ Then I have a "mypacks/mypack/broken.rb" file with content:
37
+ """
38
+ a < 1
39
+ """
40
+ Then I run bin/judges with "update mypacks simple.fb"
41
+ Then Stdout contains "Failed to update correctly"
42
+ And Exit code is not zero
43
+
44
+ Scenario: The update fails when a broken Ruby syntax in a judge
45
+ Given I make a temp directory
46
+ Then I have a "mypacks/mypack/broken.rb" file with content:
47
+ """
48
+ invalid$ruby$syntax$here
49
+ """
50
+ Then I run bin/judges with "update mypacks simple.fb"
51
+ Then Stdout contains "Failed to update correctly"
52
+ And Exit code is not zero
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ $loog.info("Trying to guess a number (judge=#{$judge})...")
24
+ $fb.txn do |fbt|
25
+ n = fbt.insert
26
+ n.number = Random.rand(100)
27
+ n.time = Time.now
28
+ end
@@ -18,17 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
19
  # SOFTWARE.
20
20
  ---
21
- input:
22
- -
23
- kind: bug was accepted
24
- reporter: yegor256
25
- time: 2024-01-01T03:15:45
26
- seen:
27
- - one
28
- - two
29
- - three
21
+ input: []
30
22
  expected:
31
- - /fb[count(f)=2]
32
- - /fb/f[kind='nominate for good bug']
33
- - /fb/f[payee='yegor256']
34
- - /fb/f[amount='15']
23
+ - /fb[count(f)=1]
24
+ - /fb/f/number
25
+ - /fb/f/time
@@ -0,0 +1,24 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ skip: true
22
+ input: []
23
+ expected:
24
+ - /should-never-reach-this-point
@@ -20,12 +20,8 @@
20
20
  ---
21
21
  input:
22
22
  -
23
- kind: bug was accepted
24
- reporter: yegor256
23
+ number: 42
25
24
  time: 2024-01-01T03:15:45
26
- seen:
27
- - one
28
- - reward_for_good_bug
29
- - two
30
25
  expected:
31
- - /fb[count(f)=1]
26
+ - /fb[count(f)=2]
27
+ - /fb/f/guess
@@ -20,13 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- $loog.info("Trying to reward a good reported bug (judge=#{$judge})...")
24
-
25
- once($fb).query("(eq kind 'bug was accepted')").each do |f|
26
- $loog.info('Good candidate found!')
23
+ once($fb).query("(and (exists number) (lt time #{Time.now.utc.iso8601}))").each do |f|
27
24
  n = $fb.insert
28
- n.kind = 'nominate for good bug'
29
- n.payee = f.reporter
30
- n.amount = 15
31
- n.message = 'thanks for reporting a bug; you get +15 points for this'
25
+ n.guess = f.number
32
26
  end
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.31'
29
+ s.version = '0.0.33'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description = '
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  s.rdoc_options = ['--charset=UTF-8']
43
43
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
44
44
  s.add_runtime_dependency 'backtrace', '~> 0.3'
45
- s.add_runtime_dependency 'factbase', '~>0.0.30'
45
+ s.add_runtime_dependency 'factbase', '~>0.0.32'
46
46
  s.add_runtime_dependency 'gli', '~>2.21'
47
47
  s.add_runtime_dependency 'loog', '~>0.2'
48
48
  s.add_runtime_dependency 'nokogiri', '~> 1.10'
@@ -46,17 +46,19 @@ class Judges::Test
46
46
  @loog.info("Testing judges in #{dir.to_rel}...")
47
47
  errors = []
48
48
  done = 0
49
- global = {}
50
49
  elapsed(@loog) do
51
50
  Judges::Packs.new(dir, opts['lib'], @loog).each_with_index do |p, i|
52
- local = {}
53
51
  next unless include?(opts, p.name)
54
52
  @loog.info("\n👉 Testing #{p.script} (##{i}) in #{p.dir.to_rel}...")
55
53
  p.tests.each do |f|
56
54
  yaml = YAML.load_file(f, permitted_classes: [Time])
55
+ if yaml['skip']
56
+ @loog.info("Skippped #{f.to_rel}")
57
+ next
58
+ end
57
59
  @loog.info("Testing #{f.to_rel}:")
58
60
  begin
59
- test_one(p, global, local, yaml)
61
+ test_one(p, yaml)
60
62
  rescue StandardError => e
61
63
  @loog.warn(Backtrace.new(e))
62
64
  errors << f
@@ -80,7 +82,7 @@ class Judges::Test
80
82
  packs.include?(name)
81
83
  end
82
84
 
83
- def test_one(pack, global, local, yaml)
85
+ def test_one(pack, yaml)
84
86
  fb = Factbase.new
85
87
  yaml['input'].each do |i|
86
88
  f = fb.insert
@@ -94,7 +96,7 @@ class Judges::Test
94
96
  end
95
97
  end
96
98
  end
97
- pack.run(Factbase::Looged.new(fb, @loog), global, local, Judges::Options.new(yaml['options']))
99
+ pack.run(Factbase::Looged.new(fb, @loog), {}, {}, Judges::Options.new(yaml['options']))
98
100
  xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
99
101
  yaml['expected'].each do |xp|
100
102
  raise "#{pack.script} doesn't match '#{xp}':\n#{xml}" if xml.xpath(xp).empty?
@@ -38,17 +38,8 @@ class Judges::Trim
38
38
  raise 'Exactly one argument required' unless args.size == 1
39
39
  impex = Judges::Impex.new(@loog, args[0])
40
40
  fb = impex.import
41
- query = opts['query']
42
- if query.nil?
43
- days = opts['days']
44
- day = Time.now - (days * 60 * 60 * 24)
45
- query = "(lt time #{day.utc.iso8601})"
46
- @loog.info("Deleting facts that are older than #{days} days")
47
- else
48
- raise 'Specify either --days or --query' unless opts['days'].nil?
49
- end
50
41
  elapsed(@loog) do
51
- deleted = fb.query(query).delete!
42
+ deleted = fb.query(opts['query']).delete!
52
43
  throw :'No facts deleted' if deleted.zero?
53
44
  impex.export(fb)
54
45
  throw :"🗑 #{deleted} fact(s) deleted"
@@ -85,7 +85,7 @@ class Judges::Update
85
85
  before = fb.size
86
86
  begin
87
87
  p.run(fb, global, local, options)
88
- rescue StandardError => e
88
+ rescue StandardError, SyntaxError => e
89
89
  @loog.warn(Backtrace.new(e))
90
90
  errors << p.script
91
91
  end
@@ -96,7 +96,10 @@ class Judges::Update
96
96
  throw :"👍 #{done} judge(s) processed" if errors.empty?
97
97
  throw :"❌ #{done} judge(s) processed with #{errors.size} errors"
98
98
  end
99
- raise "Failed to update correctly (#{errors.size} errors)" unless errors.empty? || opts['quiet']
99
+ unless errors.empty?
100
+ raise "Failed to update correctly (#{errors.size} errors)" unless opts['quiet']
101
+ @loog.info('Not failing because of the --quiet flag provided')
102
+ end
100
103
  diff
101
104
  end
102
105
  end
@@ -39,7 +39,7 @@ class TestTrim < Minitest::Test
39
39
  before.insert.time = Time.now + 1
40
40
  before.insert.time = Time.now - (100 * 24 * 60 * 60)
41
41
  File.binwrite(file, before.export)
42
- Judges::Trim.new(Loog::NULL).run({ 'days' => 10 }, [file])
42
+ Judges::Trim.new(Loog::NULL).run({ 'query' => "(lt time #{Time.now.utc.iso8601})" }, [file])
43
43
  after = Factbase.new
44
44
  after.import(File.binread(file))
45
45
  assert_equal(1, after.size)
@@ -62,9 +62,19 @@ class TestUpdate < Minitest::Test
62
62
 
63
63
  def test_update_with_error
64
64
  Dir.mktmpdir do |d|
65
- File.write(File.join(d, 'foo.rb'), 'this is a broken Ruby script')
65
+ File.write(File.join(d, 'foo.rb'), 'this$is$a$broken$Ruby$script')
66
66
  file = File.join(d, 'base.fb')
67
67
  Judges::Update.new(Loog::NULL).run({ 'quiet' => true }, [d, file])
68
68
  end
69
69
  end
70
+
71
+ def test_update_with_error_no_quiet
72
+ assert_raises do
73
+ Dir.mktmpdir do |d|
74
+ File.write(File.join(d, 'foo.rb'), 'a < 1')
75
+ file = File.join(d, 'base.fb')
76
+ Judges::Update.new(Loog::NULL).run({ 'quiet' => false }, [d, file])
77
+ end
78
+ end
79
+ end
70
80
  end
data/test/fb/test_once.rb CHANGED
@@ -34,7 +34,7 @@ class TestOnce < Minitest::Test
34
34
  def test_touch_once
35
35
  fb = once(Factbase.new, judge: 'something')
36
36
  fb.insert
37
- fb.query('()').each { |f| f.foo = 42 }
38
- assert(fb.query('()').extend(Enumerable).to_a.empty?)
37
+ fb.query('(always)').each { |f| f.foo = 42 }
38
+ assert(fb.query('(always)').extend(Enumerable).to_a.empty?)
39
39
  end
40
40
  end
data/test/test_pack.rb CHANGED
@@ -104,7 +104,31 @@ class TestPack < Minitest::Test
104
104
  pack = Judges::Pack.new(dir, lib, Loog::NULL)
105
105
  fb = Factbase.new
106
106
  pack.run(fb, {}, {}, {})
107
- assert_equal(42, fb.query('()').each.to_a.first.bar)
107
+ assert_equal(42, fb.query('(always)').each.to_a.first.bar)
108
+ end
109
+ end
110
+
111
+ def test_with_broken_ruby_syntax
112
+ assert_raises do
113
+ Dir.mktmpdir do |d|
114
+ dir = File.join(d, 'packs')
115
+ FileUtils.mkdir_p(dir)
116
+ File.write(File.join(dir, 'x.rb'), 'this$is$broken$syntax')
117
+ pack = Judges::Pack.new(dir, lib, Loog::NULL)
118
+ pack.run(Factbase.new, {}, {}, {})
119
+ end
120
+ end
121
+ end
122
+
123
+ def test_with_runtime_ruby_error
124
+ assert_raises do
125
+ Dir.mktmpdir do |d|
126
+ dir = File.join(d, 'packs')
127
+ FileUtils.mkdir_p(dir)
128
+ File.write(File.join(dir, 'x.rb'), 'a < 1')
129
+ pack = Judges::Pack.new(dir, lib, Loog::NULL)
130
+ pack.run(Factbase.new, {}, {}, {})
131
+ end
108
132
  end
109
133
  end
110
134
  end
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.0.31
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-21 00:00:00.000000000 Z
11
+ date: 2024-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.30
33
+ version: 0.0.32
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.30
40
+ version: 0.0.32
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gli
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -96,6 +96,7 @@ files:
96
96
  - ".gitattributes"
97
97
  - ".github/workflows/actionlint.yml"
98
98
  - ".github/workflows/codecov.yml"
99
+ - ".github/workflows/license.yml"
99
100
  - ".github/workflows/markdown-lint.yml"
100
101
  - ".github/workflows/pdd.yml"
101
102
  - ".github/workflows/rake.yml"
@@ -123,10 +124,11 @@ files:
123
124
  - features/test.feature
124
125
  - features/trim.feature
125
126
  - features/update.feature
126
- - fixtures/reward_for_good_bug/README.md
127
- - fixtures/reward_for_good_bug/no-reward.yml
128
- - fixtures/reward_for_good_bug/reward_it.rb
129
- - fixtures/reward_for_good_bug/simple-reward.yml
127
+ - fixtures/guess/guess.rb
128
+ - fixtures/guess/guess_made.yml
129
+ - fixtures/guess/skipped.yml
130
+ - fixtures/try/tried.yml
131
+ - fixtures/try/try.rb
130
132
  - judges.gemspec
131
133
  - lib/judges.rb
132
134
  - lib/judges/commands/eval.rb
@@ -1,8 +0,0 @@
1
- # Why bugs reports are rewarded?
2
-
3
- Every bug reported and accepted deserves a reward, which
4
- are given to the reporter of the bug. A bug is considered as
5
- "accepted" only if it has the `bug`, `enhancement`, or `question` label
6
- attached to it. Such a reward encourages programmers to report
7
- more bugs, thus revealing problems that will be fixed before they
8
- are shipped to a customer.