judges 0.30.0 → 0.31.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.0pdd.yml +1 -1
- data/.github/workflows/actionlint.yml +1 -1
- data/.github/workflows/codecov.yml +4 -2
- data/.github/workflows/copyrights.yml +1 -1
- data/.github/workflows/markdown-lint.yml +1 -1
- data/.github/workflows/pdd.yml +2 -2
- data/.github/workflows/rake.yml +2 -2
- data/.github/workflows/xcop.yml +1 -1
- data/.github/workflows/yamllint.yml +1 -1
- data/.gitignore +1 -1
- data/.rubocop.yml +6 -1
- data/.rultor.yml +1 -1
- data/.simplecov +1 -1
- data/Gemfile +6 -5
- data/Gemfile.lock +56 -42
- data/LICENSE.txt +1 -1
- data/Rakefile +1 -1
- data/assets/index.xsl +1 -1
- data/bin/judges +3 -3
- data/features/inspect.feature +0 -1
- data/features/pull.feature +0 -1
- data/features/step_definitions/steps.rb +1 -1
- data/features/support/env.rb +1 -1
- data/fixtures/guess/guess.rb +1 -1
- data/fixtures/guess/guess_made.yml +1 -1
- data/fixtures/guess/skipped.yml +1 -1
- data/fixtures/try/tried.yml +1 -1
- data/fixtures/try/try.rb +1 -1
- data/judges.gemspec +3 -3
- data/lib/judges/categories.rb +4 -4
- data/lib/judges/churn.rb +2 -2
- data/lib/judges/commands/eval.rb +2 -2
- data/lib/judges/commands/import.rb +3 -3
- data/lib/judges/commands/inspect.rb +2 -2
- data/lib/judges/commands/join.rb +2 -2
- data/lib/judges/commands/print.rb +2 -2
- data/lib/judges/commands/pull.rb +2 -2
- data/lib/judges/commands/push.rb +2 -2
- data/lib/judges/commands/test.rb +4 -4
- data/lib/judges/commands/trim.rb +2 -2
- data/lib/judges/commands/update.rb +11 -7
- data/lib/judges/impex.rb +2 -2
- data/lib/judges/judge.rb +2 -2
- data/lib/judges/judges.rb +2 -2
- data/lib/judges/options.rb +2 -2
- data/lib/judges/to_rel.rb +2 -2
- data/lib/judges.rb +3 -3
- data/test/commands/test_eval.rb +3 -3
- data/test/commands/test_import.rb +3 -3
- data/test/commands/test_inspect.rb +3 -3
- data/test/commands/test_join.rb +5 -5
- data/test/commands/test_print.rb +8 -8
- data/test/commands/test_pull.rb +4 -4
- data/test/commands/test_push.rb +3 -3
- data/test/commands/test_test.rb +4 -4
- data/test/commands/test_trim.rb +2 -2
- data/test/commands/test_update.rb +10 -10
- data/test/test__helper.rb +1 -1
- data/test/test_bin.rb +3 -3
- data/test/test_categories.rb +7 -7
- data/test/test_churn.rb +2 -2
- data/test/test_impex.rb +2 -2
- data/test/test_judge.rb +7 -7
- data/test/test_judges.rb +3 -3
- data/test/test_options.rb +11 -11
- data/test/test_to_rel.rb +2 -2
- metadata +6 -6
data/lib/judges/commands/join.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -30,7 +30,7 @@ require_relative '../../judges/impex'
|
|
30
30
|
# are not supposed to instantiate it yourself.
|
31
31
|
#
|
32
32
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
33
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
33
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
34
34
|
# License:: MIT
|
35
35
|
class Judges::Join
|
36
36
|
def initialize(loog)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -34,7 +34,7 @@ require_relative '../../judges/impex'
|
|
34
34
|
# are not supposed to instantiate it yourself.
|
35
35
|
#
|
36
36
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
37
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
37
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
38
38
|
# License:: MIT
|
39
39
|
class Judges::Print
|
40
40
|
def initialize(loog)
|
data/lib/judges/commands/pull.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -33,7 +33,7 @@ require_relative '../../judges/impex'
|
|
33
33
|
# are not supposed to instantiate it yourself.
|
34
34
|
#
|
35
35
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
36
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
36
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
37
37
|
# License:: MIT
|
38
38
|
class Judges::Pull
|
39
39
|
def initialize(loog)
|
data/lib/judges/commands/push.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -33,7 +33,7 @@ require_relative '../../judges/impex'
|
|
33
33
|
# are not supposed to instantiate it yourself.
|
34
34
|
#
|
35
35
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
36
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
36
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
37
37
|
# License:: MIT
|
38
38
|
class Judges::Push
|
39
39
|
def initialize(loog)
|
data/lib/judges/commands/test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -38,7 +38,7 @@ require_relative '../../judges/categories'
|
|
38
38
|
# are not supposed to instantiate it yourself.
|
39
39
|
#
|
40
40
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
41
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
41
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
42
42
|
# License:: MIT
|
43
43
|
class Judges::Test
|
44
44
|
def initialize(loog)
|
@@ -134,10 +134,10 @@ class Judges::Test
|
|
134
134
|
i.each do |k, vv|
|
135
135
|
if vv.is_a?(Array)
|
136
136
|
vv.each do |v|
|
137
|
-
f.send("#{k}=", v)
|
137
|
+
f.send(:"#{k}=", v)
|
138
138
|
end
|
139
139
|
else
|
140
|
-
f.send("#{k}=", vv)
|
140
|
+
f.send(:"#{k}=", vv)
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|
data/lib/judges/commands/trim.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -31,7 +31,7 @@ require_relative '../../judges/impex'
|
|
31
31
|
# are not supposed to instantiate it yourself.
|
32
32
|
#
|
33
33
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
34
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
34
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
35
35
|
# License:: MIT
|
36
36
|
class Judges::Trim
|
37
37
|
def initialize(loog)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -38,7 +38,7 @@ require_relative '../../judges/impex'
|
|
38
38
|
# are not supposed to instantiate it yourself.
|
39
39
|
#
|
40
40
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
41
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
41
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
42
42
|
# License:: MIT
|
43
43
|
class Judges::Update
|
44
44
|
def initialize(loog)
|
@@ -157,19 +157,23 @@ class Judges::Update
|
|
157
157
|
def one_judge(opts, fb, judge, global, options)
|
158
158
|
local = {}
|
159
159
|
before = fb.size
|
160
|
+
churn = Judges::Churn.new(0, 0)
|
160
161
|
begin
|
161
162
|
Timeout.timeout(opts['timeout']) do
|
162
163
|
judge.run(fb, global, local, options)
|
163
164
|
end
|
164
165
|
rescue Timeout::Error => e
|
166
|
+
churn << "Judge #{judge.name} stopped by timeout: #{e.message}"
|
165
167
|
throw :"👎 The '#{judge.name}' judge timed out: #{e.message}"
|
166
168
|
end
|
167
169
|
after = fb.size
|
168
170
|
diff = after - before
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
171
|
+
churn +=
|
172
|
+
if diff.positive?
|
173
|
+
Judges::Churn.new(diff, 0)
|
174
|
+
else
|
175
|
+
Judges::Churn.new(0, -diff)
|
176
|
+
end
|
177
|
+
churn
|
174
178
|
end
|
175
179
|
end
|
data/lib/judges/impex.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative '../judges/to_rel'
|
|
28
28
|
|
29
29
|
# Import/Export of factbases.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class Judges::Impex
|
34
34
|
def initialize(loog, file)
|
data/lib/judges/judge.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -27,7 +27,7 @@ require_relative '../judges/to_rel'
|
|
27
27
|
|
28
28
|
# A single judge.
|
29
29
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
30
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
31
31
|
# License:: MIT
|
32
32
|
class Judges::Judge
|
33
33
|
attr_reader :dir
|
data/lib/judges/judges.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -40,7 +40,7 @@ require_relative 'judge'
|
|
40
40
|
# name of the +.rb+ script inside the directory.
|
41
41
|
#
|
42
42
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
43
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
43
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
44
44
|
# License:: MIT
|
45
45
|
class Judges::Judges
|
46
46
|
def initialize(dir, lib, loog, start: Time.now)
|
data/lib/judges/options.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -25,7 +25,7 @@ require_relative '../judges'
|
|
25
25
|
|
26
26
|
# Options for Ruby scripts in the judges.
|
27
27
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
28
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
28
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
29
29
|
# License:: MIT
|
30
30
|
class Judges::Options
|
31
31
|
# Ctor.
|
data/lib/judges/to_rel.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,7 +24,7 @@ require 'pathname'
|
|
24
24
|
|
25
25
|
# Adding method +to_rel+ to all Ruby objects.
|
26
26
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
27
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
27
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
28
28
|
# License:: MIT
|
29
29
|
class Object
|
30
30
|
# Generates a relative name of a file (to the current dir).
|
data/lib/judges.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -22,8 +22,8 @@
|
|
22
22
|
|
23
23
|
# Judges.
|
24
24
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
25
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
25
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
26
26
|
# License:: MIT
|
27
27
|
module Judges
|
28
|
-
VERSION = '0.
|
28
|
+
VERSION = '0.31.1'
|
29
29
|
end
|
data/test/commands/test_eval.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -30,7 +30,7 @@ require_relative '../../lib/judges/commands/eval'
|
|
30
30
|
|
31
31
|
# Test.
|
32
32
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
33
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
33
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
34
34
|
# License:: MIT
|
35
35
|
class TestEval < Minitest::Test
|
36
36
|
def test_build_factbase_from_scratch
|
@@ -40,7 +40,7 @@ class TestEval < Minitest::Test
|
|
40
40
|
fb = Factbase.new
|
41
41
|
fb.import(File.binread(file))
|
42
42
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
43
|
-
|
43
|
+
refute_empty(xml.xpath('/fb/f[foo="42"]'), xml)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -30,7 +30,7 @@ require_relative '../../lib/judges/commands/import'
|
|
30
30
|
|
31
31
|
# Test.
|
32
32
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
33
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
33
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
34
34
|
# License:: MIT
|
35
35
|
class TestImport < Minitest::Test
|
36
36
|
def test_import_from_yaml
|
@@ -52,7 +52,7 @@ class TestImport < Minitest::Test
|
|
52
52
|
fb = Factbase.new
|
53
53
|
fb.import(File.binread(file))
|
54
54
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
55
|
-
|
55
|
+
refute_empty(xml.xpath('/fb[count(f)=2]'), xml)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative '../../lib/judges/commands/inspect'
|
|
28
28
|
|
29
29
|
# Test.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class TestInspect < Minitest::Test
|
34
34
|
def test_simple_inspect
|
@@ -40,7 +40,7 @@ class TestInspect < Minitest::Test
|
|
40
40
|
File.binwrite(f, fb.export)
|
41
41
|
loog = Loog::Buffer.new
|
42
42
|
Judges::Inspect.new(loog).run({}, [f])
|
43
|
-
|
43
|
+
assert_includes(loog.to_s, 'Facts: 2')
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
data/test/commands/test_join.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -29,7 +29,7 @@ require_relative '../../lib/judges/commands/join'
|
|
29
29
|
|
30
30
|
# Test.
|
31
31
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
32
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
33
33
|
# License:: MIT
|
34
34
|
class TestJoin < Minitest::Test
|
35
35
|
def test_simple_join
|
@@ -47,9 +47,9 @@ class TestJoin < Minitest::Test
|
|
47
47
|
fb = Factbase.new
|
48
48
|
fb.import(File.binread(master))
|
49
49
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
refute_empty(xml.xpath('/fb/f[zz="5"]'), xml)
|
51
|
+
refute_empty(xml.xpath('/fb/f[foo_bar="42"]'), xml)
|
52
|
+
assert_includes(loog.to_s, 'Two factbases joined', loog.to_s)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
data/test/commands/test_print.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -34,7 +34,7 @@ require_relative '../../lib/judges/commands/print'
|
|
34
34
|
|
35
35
|
# Test.
|
36
36
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
37
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
37
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
38
38
|
# License:: MIT
|
39
39
|
class TestPrint < Minitest::Test
|
40
40
|
def test_simple_print
|
@@ -45,7 +45,7 @@ class TestPrint < Minitest::Test
|
|
45
45
|
File.binwrite(f, fb.export)
|
46
46
|
Judges::Print.new(Loog::NULL).run({ 'format' => 'yaml', 'auto' => true }, [f])
|
47
47
|
y = File.join(d, 'base.yaml')
|
48
|
-
|
48
|
+
assert_path_exists(y)
|
49
49
|
assert_equal(1, YAML.load_file(y).size)
|
50
50
|
end
|
51
51
|
end
|
@@ -83,11 +83,11 @@ class TestPrint < Minitest::Test
|
|
83
83
|
rescue StandardError => e
|
84
84
|
raise "#{doc}\n\n#{e}"
|
85
85
|
end
|
86
|
-
|
87
|
-
|
86
|
+
assert_empty(xml.errors, xml)
|
87
|
+
refute_empty(xml.xpath('/html'), xml)
|
88
88
|
WebMock.enable_net_connect!
|
89
89
|
v = W3CValidators::NuValidator.new.validate_file(html)
|
90
|
-
|
90
|
+
assert_empty(v.errors, "#{doc}\n\n#{v.errors.join('; ')}")
|
91
91
|
end
|
92
92
|
|
93
93
|
def test_print_all_formats
|
@@ -99,7 +99,7 @@ class TestPrint < Minitest::Test
|
|
99
99
|
File.binwrite(f, fb.export)
|
100
100
|
Judges::Print.new(Loog::NULL).run({ 'format' => fmt, 'auto' => true }, [f])
|
101
101
|
y = File.join(d, "base.#{fmt}")
|
102
|
-
|
102
|
+
assert_path_exists(y)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -112,7 +112,7 @@ class TestPrint < Minitest::Test
|
|
112
112
|
File.binwrite(f, fb.export)
|
113
113
|
Judges::Print.new(Loog::NULL).run({ 'format' => 'yaml', 'auto' => true }, [f])
|
114
114
|
y = File.join(d, 'base.yaml')
|
115
|
-
|
115
|
+
assert_path_exists(y)
|
116
116
|
mtime = File.mtime(y)
|
117
117
|
Judges::Print.new(Loog::NULL).run({ 'format' => 'yaml', 'auto' => true }, [f])
|
118
118
|
assert_equal(mtime, File.mtime(y))
|
data/test/commands/test_pull.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -29,7 +29,7 @@ require_relative '../../lib/judges/commands/pull'
|
|
29
29
|
|
30
30
|
# Test.
|
31
31
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
32
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
33
33
|
# License:: MIT
|
34
34
|
class TestPull < Minitest::Test
|
35
35
|
def test_pull_simple_factbase
|
@@ -73,7 +73,7 @@ class TestPull < Minitest::Test
|
|
73
73
|
Dir.mktmpdir do |d|
|
74
74
|
file = File.join(d, 'base.fb')
|
75
75
|
e =
|
76
|
-
assert_raises do
|
76
|
+
assert_raises(StandardError) do
|
77
77
|
Judges::Pull.new(Loog::NULL).run(
|
78
78
|
{
|
79
79
|
'token' => '000',
|
@@ -86,7 +86,7 @@ class TestPull < Minitest::Test
|
|
86
86
|
['foo', file]
|
87
87
|
)
|
88
88
|
end
|
89
|
-
|
89
|
+
assert_includes(e.message, 'expire it', e)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
data/test/commands/test_push.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative '../../lib/judges/commands/push'
|
|
28
28
|
|
29
29
|
# Test.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class TestPush < Minitest::Test
|
34
34
|
def test_push_simple_factbase
|
@@ -77,7 +77,7 @@ class TestPush < Minitest::Test
|
|
77
77
|
fb = Factbase.new
|
78
78
|
fb.insert.foo_bar = 42
|
79
79
|
File.binwrite(file, fb.export)
|
80
|
-
assert_raises do
|
80
|
+
assert_raises(StandardError) do
|
81
81
|
Judges::Push.new(Loog::NULL).run(
|
82
82
|
{
|
83
83
|
'token' => '000',
|
data/test/commands/test_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative '../../lib/judges/commands/test'
|
|
28
28
|
|
29
29
|
# Test.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
31
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
class TestTest < Minitest::Test
|
34
34
|
def test_positive
|
@@ -65,7 +65,7 @@ class TestTest < Minitest::Test
|
|
65
65
|
- /fb/f[bar/v='5']
|
66
66
|
YAML
|
67
67
|
)
|
68
|
-
assert_raises do
|
68
|
+
assert_raises(StandardError) do
|
69
69
|
Judges::Test.new(Loog::NULL).run({}, [d])
|
70
70
|
end
|
71
71
|
end
|
@@ -123,7 +123,7 @@ class TestTest < Minitest::Test
|
|
123
123
|
- /fb[count(f)=1]
|
124
124
|
YAML
|
125
125
|
)
|
126
|
-
assert_raises do
|
126
|
+
assert_raises(StandardError) do
|
127
127
|
Judges::Test.new(Loog::NULL).run({ 'judge' => [File.basename(dir)] }, [d])
|
128
128
|
end
|
129
129
|
end
|
data/test/commands/test_trim.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -29,7 +29,7 @@ require_relative '../../lib/judges/commands/trim'
|
|
29
29
|
|
30
30
|
# Test.
|
31
31
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
32
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
33
33
|
# License:: MIT
|
34
34
|
class TestTrim < Minitest::Test
|
35
35
|
def test_trims_factbase
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -30,7 +30,7 @@ require_relative '../../lib/judges/commands/update'
|
|
30
30
|
|
31
31
|
# Test.
|
32
32
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
33
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
33
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
34
34
|
# License:: MIT
|
35
35
|
class TestUpdate < Minitest::Test
|
36
36
|
def test_build_factbase_from_scratch
|
@@ -41,7 +41,7 @@ class TestUpdate < Minitest::Test
|
|
41
41
|
fb = Factbase.new
|
42
42
|
fb.import(File.binread(file))
|
43
43
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
44
|
-
|
44
|
+
refute_empty(xml.xpath('/fb/f[zzz="43"]'), xml)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -53,7 +53,7 @@ class TestUpdate < Minitest::Test
|
|
53
53
|
fb = Factbase.new
|
54
54
|
fb.import(File.binread(file))
|
55
55
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
56
|
-
|
56
|
+
assert_empty(xml.xpath('/fb/f'), xml)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -68,8 +68,8 @@ class TestUpdate < Minitest::Test
|
|
68
68
|
fb = Factbase.new
|
69
69
|
fb.import(File.binread(file))
|
70
70
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
71
|
-
|
72
|
-
|
71
|
+
refute_empty(xml.xpath('/fb/f[tt="4"]'), xml)
|
72
|
+
refute_empty(xml.xpath('/fb/f[foo_bar="42"]'), xml)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -91,12 +91,12 @@ class TestUpdate < Minitest::Test
|
|
91
91
|
fb = Factbase.new
|
92
92
|
fb.import(File.binread(file))
|
93
93
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
94
|
-
|
94
|
+
refute_empty(xml.xpath('/fb/f[foo="444"]'), xml)
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
98
|
def test_update_with_error_no_quiet
|
99
|
-
assert_raises do
|
99
|
+
assert_raises(StandardError) do
|
100
100
|
Dir.mktmpdir do |d|
|
101
101
|
save_it(File.join(d, 'foo/foo.rb'), 'a < 1')
|
102
102
|
file = File.join(d, 'base.fb')
|
@@ -120,8 +120,8 @@ class TestUpdate < Minitest::Test
|
|
120
120
|
sums = fb.query('(eq what "judges-summary")').each.to_a
|
121
121
|
assert_equal(1, sums.size)
|
122
122
|
sum = sums.first
|
123
|
-
|
124
|
-
|
123
|
+
assert_includes(sum.error, 'unexpected global variable', sum.error)
|
124
|
+
refute_nil(sum.seconds)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|
data/test/test__helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/test/test_bin.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,7 +24,7 @@ require 'minitest/autorun'
|
|
24
24
|
|
25
25
|
# Test.
|
26
26
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
27
|
-
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
27
|
+
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
28
28
|
# License:: MIT
|
29
29
|
class TestBin < Minitest::Test
|
30
30
|
def test_simple_run
|
@@ -38,6 +38,6 @@ class TestBin < Minitest::Test
|
|
38
38
|
ensure
|
39
39
|
$stdout = before
|
40
40
|
end
|
41
|
-
|
41
|
+
assert_includes(s, Judges::VERSION, s)
|
42
42
|
end
|
43
43
|
end
|