ruptr 0.1.3 → 0.1.4
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/lib/ruptr/adapters/assertions.rb +2 -2
- data/lib/ruptr/instance.rb +16 -3
- data/lib/ruptr/main.rb +3 -1
- data/lib/ruptr/plain.rb +26 -7
- data/lib/ruptr/report.rb +9 -5
- data/lib/ruptr/result.rb +12 -5
- data/lib/ruptr/runner.rb +9 -7
- data/lib/ruptr/suite.rb +4 -0
- data/lib/ruptr/testunit.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c1c620a24a46591c8ac0c6f1cd9cd8d8ebb0edc5e3e00a7c6df78c76a5e0d4f0
|
|
4
|
+
data.tar.gz: ec3a479909a07b44a483143cc603ec83c792a23f4208f051a6849b0f40a9ebf8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7f5c28f76a6f964d8284a86995f1a855329110ae1adb6569ef09c580eb300ffb98d2fc8f7aa7e4de89f9bbdfdc745c08fdba92a32ffb8b2d80ed866b26fca651
|
|
7
|
+
data.tar.gz: 1028321f3377a7d8744377a3aa612a9d85ab58af2a5f237bdbb0c9acf36ee0692fff09d7d077da611dd9cea5b126468dde619e82f0812a9f119375056c71fb01
|
|
@@ -32,8 +32,8 @@ module Ruptr
|
|
|
32
32
|
assertions_golden_store.set_trial(assertion_golden_key(k), v)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
def assertion_golden_value_missing(
|
|
36
|
-
|
|
35
|
+
def assertion_golden_value_missing(_k)
|
|
36
|
+
self.ruptr_ineffective_assertions_count += 1
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def assertion_yield_golden_value(k)
|
data/lib/ruptr/instance.rb
CHANGED
|
@@ -12,7 +12,7 @@ module Ruptr
|
|
|
12
12
|
|
|
13
13
|
# Common methods to let multiple assertions/expectations libraries use a shared assertions
|
|
14
14
|
# counter. The @_assertions instance variable name was chosen to be compatible with
|
|
15
|
-
# Test::Unit::
|
|
15
|
+
# Test::Unit::CoreAssertions (gem test-unit-ruby-core) which accesses it directly.
|
|
16
16
|
|
|
17
17
|
def ruptr_assertions_count
|
|
18
18
|
@_assertions || 0
|
|
@@ -22,14 +22,27 @@ module Ruptr
|
|
|
22
22
|
@_assertions = n
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def ruptr_ineffective_assertions_count
|
|
26
|
+
@ruptr_ineffective_assertions_count || 0
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def ruptr_ineffective_assertions_count=(n)
|
|
30
|
+
@ruptr_ineffective_assertions_count = n
|
|
31
|
+
end
|
|
32
|
+
|
|
25
33
|
def ruptr_internal_variable?(name)
|
|
26
|
-
name == :@_assertions || name == :@ruptr_context
|
|
34
|
+
name == :@_assertions || name == :@ruptr_ineffective_assertions_count || name == :@ruptr_context
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private def ruptr_update_context
|
|
38
|
+
ruptr_context.assertions_count += ruptr_assertions_count
|
|
39
|
+
ruptr_context.ineffective_assertions_count += ruptr_ineffective_assertions_count
|
|
27
40
|
end
|
|
28
41
|
|
|
29
42
|
def ruptr_wrap_test_instance
|
|
30
43
|
yield
|
|
31
44
|
ensure
|
|
32
|
-
|
|
45
|
+
ruptr_update_context
|
|
33
46
|
end
|
|
34
47
|
|
|
35
48
|
def inspect = "#<#{self.class}: #{ruptr_context.test_element}>"
|
data/lib/ruptr/main.rb
CHANGED
|
@@ -209,10 +209,12 @@ module Ruptr
|
|
|
209
209
|
@pager_mode && !@output_path && $stdout.tty?
|
|
210
210
|
end
|
|
211
211
|
|
|
212
|
+
private def default_pager_cmd = 'LESS=-R less'
|
|
213
|
+
|
|
212
214
|
private def open_output
|
|
213
215
|
fail if @output_file
|
|
214
216
|
if pager_mode? && (!@pager_only_on_problem || test_suite_problem?)
|
|
215
|
-
@output_file = IO.popen(ENV['PAGER'] ||
|
|
217
|
+
@output_file = IO.popen(ENV['PAGER'] || default_pager_cmd, 'w',
|
|
216
218
|
external_encoding: $stdout.external_encoding)
|
|
217
219
|
@output_file_close = true
|
|
218
220
|
else
|
data/lib/ruptr/plain.rb
CHANGED
|
@@ -207,7 +207,11 @@ module Ruptr
|
|
|
207
207
|
a << "#{'%0.6f' % tr.user_time} user" if tr.user_time
|
|
208
208
|
a << "#{'%0.6f' % tr.system_time} system" if tr.system_time
|
|
209
209
|
line("Processor time: #{a.join(', ')}") unless a.empty?
|
|
210
|
-
|
|
210
|
+
a = []
|
|
211
|
+
a << "#{tr.assertions}" unless tr.assertions.zero?
|
|
212
|
+
a << colorize("#{tr.ineffective_assertions} ineffective", color: :yellow) \
|
|
213
|
+
unless tr.ineffective_assertions.zero?
|
|
214
|
+
line("Assertion count: #{a.join(', ')}") unless a.empty?
|
|
211
215
|
newline
|
|
212
216
|
end
|
|
213
217
|
|
|
@@ -276,8 +280,15 @@ module Ruptr
|
|
|
276
280
|
title = "WARNING ##{@warned_index}"
|
|
277
281
|
@warned_index += 1
|
|
278
282
|
color = :yellow
|
|
283
|
+
elsif !tr.ineffective_assertions.zero?
|
|
284
|
+
@total_passed_ineffective_cases += 1 if te.test_case?
|
|
285
|
+
@total_passed_ineffective_groups += 1 if te.test_group?
|
|
286
|
+
return unless verbose?(2)
|
|
287
|
+
title = "INEFFECTIVE ##{@ineffective_index}"
|
|
288
|
+
@ineffective_index += 1
|
|
289
|
+
color = :yellow
|
|
279
290
|
else
|
|
280
|
-
return unless verbose?(
|
|
291
|
+
return unless verbose?(4)
|
|
281
292
|
title = "PASSED ##{@passed_index}"
|
|
282
293
|
@passed_index += 1
|
|
283
294
|
color = :green
|
|
@@ -346,7 +357,11 @@ module Ruptr
|
|
|
346
357
|
|
|
347
358
|
s = +''
|
|
348
359
|
s << "Ran #{@total_test_cases} test cases"
|
|
349
|
-
|
|
360
|
+
a = []
|
|
361
|
+
a << "#{@total_assertions} assertions" unless @total_assertions.zero?
|
|
362
|
+
a << colorize("#{@total_ineffective_assertions} ineffective assertions", color: :yellow) \
|
|
363
|
+
unless @total_ineffective_assertions.zero?
|
|
364
|
+
s << " with #{a.join(' and ')}" unless a.empty?
|
|
350
365
|
s << ": "
|
|
351
366
|
|
|
352
367
|
s << colorize("#{@total_passed_cases} passed",
|
|
@@ -394,15 +409,18 @@ module Ruptr
|
|
|
394
409
|
@heading_count = 0
|
|
395
410
|
@unknown_index = @failed_index = @blocked_index =
|
|
396
411
|
@skipped_index = @pending_index =
|
|
397
|
-
@passed_index = @warned_index =
|
|
412
|
+
@passed_index = @warned_index =
|
|
413
|
+
@ineffective_index = 1
|
|
398
414
|
@total_test_cases = @total_test_groups = 0
|
|
399
415
|
@total_failed_cases = @total_blocked_cases =
|
|
400
416
|
@total_skipped_cases = @total_skipped_pending_cases =
|
|
401
|
-
@total_passed_cases = @total_passed_warned_cases =
|
|
417
|
+
@total_passed_cases = @total_passed_warned_cases =
|
|
418
|
+
@total_passed_ineffective_cases = 0
|
|
402
419
|
@total_failed_groups = @total_blocked_groups =
|
|
403
420
|
@total_skipped_groups = @total_skipped_pending_groups =
|
|
404
|
-
@total_passed_groups = @total_passed_warned_groups =
|
|
405
|
-
|
|
421
|
+
@total_passed_groups = @total_passed_warned_groups =
|
|
422
|
+
@total_passed_ineffective_groups = 0
|
|
423
|
+
@total_assertions = @total_ineffective_assertions = 0
|
|
406
424
|
end
|
|
407
425
|
|
|
408
426
|
def finish_plan(fields)
|
|
@@ -419,6 +437,7 @@ module Ruptr
|
|
|
419
437
|
@total_test_cases += 1 if te.test_case?
|
|
420
438
|
@total_test_groups += 1 if te.test_group?
|
|
421
439
|
@total_assertions += tr.assertions
|
|
440
|
+
@total_ineffective_assertions += tr.ineffective_assertions
|
|
422
441
|
render_element(te, tr)
|
|
423
442
|
end
|
|
424
443
|
end
|
data/lib/ruptr/report.rb
CHANGED
|
@@ -9,23 +9,26 @@ module Ruptr
|
|
|
9
9
|
def initialize
|
|
10
10
|
@results = {}
|
|
11
11
|
@failed = false
|
|
12
|
-
@total_assertions = 0
|
|
12
|
+
@total_assertions = @total_ineffective_assertions = 0
|
|
13
13
|
@total_test_cases = 0
|
|
14
14
|
@total_test_cases_by_status = Hash.new(0)
|
|
15
15
|
@total_test_groups = 0
|
|
16
16
|
@total_test_groups_by_status = Hash.new(0)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
attr_reader :total_assertions,
|
|
19
|
+
attr_reader :total_assertions, :total_ineffective_assertions,
|
|
20
20
|
:total_test_cases,
|
|
21
21
|
:total_test_groups
|
|
22
22
|
|
|
23
23
|
def failed? = @failed
|
|
24
24
|
def passed? = !failed?
|
|
25
25
|
|
|
26
|
+
def total_test_cases_by_status(status) = @total_test_cases_by_status[status]
|
|
27
|
+
def total_test_groups_by_status(status) = @total_test_groups_by_status[status]
|
|
28
|
+
|
|
26
29
|
TestResult::VALID_STATUSES.each do |status|
|
|
27
|
-
define_method(:"total_#{status}_test_cases") {
|
|
28
|
-
define_method(:"total_#{status}_test_groups") {
|
|
30
|
+
define_method(:"total_#{status}_test_cases") { total_test_cases_by_status(status) }
|
|
31
|
+
define_method(:"total_#{status}_test_groups") { total_test_groups_by_status(status) }
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
def each_test_element_result(klass = TestElement, &)
|
|
@@ -60,7 +63,8 @@ module Ruptr
|
|
|
60
63
|
else
|
|
61
64
|
raise ArgumentError
|
|
62
65
|
end
|
|
63
|
-
@total_assertions += tr.assertions
|
|
66
|
+
@total_assertions += tr.assertions
|
|
67
|
+
@total_ineffective_assertions += tr.ineffective_assertions
|
|
64
68
|
@failed ||= tr.failed?
|
|
65
69
|
@results[te] = tr
|
|
66
70
|
end
|
data/lib/ruptr/result.rb
CHANGED
|
@@ -10,20 +10,27 @@ module Ruptr
|
|
|
10
10
|
VALID_STATUSES = %i[passed skipped failed blocked].freeze
|
|
11
11
|
|
|
12
12
|
def initialize(status,
|
|
13
|
-
|
|
13
|
+
exception: nil,
|
|
14
|
+
assertions: 0, ineffective_assertions: 0,
|
|
15
|
+
user_time: nil, system_time: nil,
|
|
14
16
|
captured_stdout: nil, captured_stderr: nil)
|
|
15
17
|
raise ArgumentError unless VALID_STATUSES.include?(status)
|
|
16
18
|
raise ArgumentError if exception && status == :passed
|
|
17
19
|
@status = status
|
|
20
|
+
@exception = exception
|
|
18
21
|
@assertions = assertions
|
|
19
|
-
@
|
|
20
|
-
@captured_stderr = captured_stderr
|
|
22
|
+
@ineffective_assertions = ineffective_assertions
|
|
21
23
|
@user_time = user_time
|
|
22
24
|
@system_time = system_time
|
|
23
|
-
@
|
|
25
|
+
@captured_stdout = captured_stdout
|
|
26
|
+
@captured_stderr = captured_stderr
|
|
24
27
|
end
|
|
25
28
|
|
|
26
|
-
attr_reader :status,
|
|
29
|
+
attr_reader :status,
|
|
30
|
+
:exception,
|
|
31
|
+
:assertions, :ineffective_assertions,
|
|
32
|
+
:user_time, :system_time,
|
|
33
|
+
:captured_stdout, :captured_stderr
|
|
27
34
|
|
|
28
35
|
def passed? = @status == :passed
|
|
29
36
|
def skipped? = @status == :skipped
|
data/lib/ruptr/runner.rb
CHANGED
|
@@ -14,11 +14,11 @@ module Ruptr
|
|
|
14
14
|
@runner = runner
|
|
15
15
|
@test_element = test_element
|
|
16
16
|
@parent = parent
|
|
17
|
-
@assertions_count = 0
|
|
17
|
+
@assertions_count = @ineffective_assertions_count = 0
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
attr_reader :runner, :test_element, :parent
|
|
21
|
-
attr_accessor :assertions_count
|
|
21
|
+
attr_accessor :assertions_count, :ineffective_assertions_count
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
class TestElement
|
|
@@ -47,26 +47,28 @@ module Ruptr
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
assertions = context.assertions_count
|
|
50
|
+
ineffective_assertions = context.ineffective_assertions_count
|
|
50
51
|
TestResult.new(status,
|
|
51
|
-
|
|
52
|
+
exception:,
|
|
53
|
+
assertions:, ineffective_assertions:,
|
|
54
|
+
user_time:, system_time:,
|
|
52
55
|
captured_stdout:, captured_stderr:)
|
|
53
56
|
end
|
|
54
57
|
end
|
|
55
58
|
|
|
56
59
|
class TestCase
|
|
57
60
|
def run_result(runner, group_context)
|
|
61
|
+
return TestResult.new(:skipped) unless runnable?
|
|
58
62
|
context = Context.new(runner, self, group_context)
|
|
59
63
|
make_result(context) { run_context(context) }
|
|
60
64
|
end
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
class TestGroup
|
|
64
|
-
def must_wrap? = block?
|
|
65
|
-
|
|
66
68
|
def wrap_result(runner, parent_context)
|
|
67
69
|
context = Context.new(runner, self, parent_context)
|
|
68
70
|
make_result(context) do
|
|
69
|
-
if
|
|
71
|
+
if wrappable?
|
|
70
72
|
wrap_context(context) { yield context }
|
|
71
73
|
else
|
|
72
74
|
yield context
|
|
@@ -187,7 +189,7 @@ module Ruptr
|
|
|
187
189
|
batched_cases << tc
|
|
188
190
|
end
|
|
189
191
|
tg.each_test_subgroup do |tg|
|
|
190
|
-
if tg.
|
|
192
|
+
if tg.wrappable?
|
|
191
193
|
pending_groups << tg
|
|
192
194
|
else
|
|
193
195
|
@sink.submit_group(tg) do
|
data/lib/ruptr/suite.rb
CHANGED
|
@@ -62,6 +62,8 @@ module Ruptr
|
|
|
62
62
|
class TestCase < TestElement
|
|
63
63
|
def test_case? = true
|
|
64
64
|
|
|
65
|
+
def runnable? = block?
|
|
66
|
+
|
|
65
67
|
def run_context(context) = @block.call(context)
|
|
66
68
|
end
|
|
67
69
|
|
|
@@ -74,6 +76,8 @@ module Ruptr
|
|
|
74
76
|
|
|
75
77
|
def test_group? = true
|
|
76
78
|
|
|
79
|
+
def wrappable? = block?
|
|
80
|
+
|
|
77
81
|
def wrap_context(context, &) = @block.call(context, &)
|
|
78
82
|
|
|
79
83
|
def each_test_case(&) = @test_cases.each(&)
|
data/lib/ruptr/testunit.rb
CHANGED
|
@@ -67,6 +67,8 @@ module Ruptr
|
|
|
67
67
|
|
|
68
68
|
assertions_module = def_module(:Assertions) do
|
|
69
69
|
include(Adapters::RuptrAssertions)
|
|
70
|
+
# NOTE: Gem test-unit-ruby-core's "core_assertions" library will define some methods
|
|
71
|
+
# directly in Test::Unit::Assertions.
|
|
70
72
|
end
|
|
71
73
|
|
|
72
74
|
def_class(:TestCase) do
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruptr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mathieu
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-02-
|
|
10
|
+
date: 2025-02-25 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
email: sigsys@gmail.com
|
|
13
13
|
executables:
|
|
@@ -53,6 +53,7 @@ files:
|
|
|
53
53
|
- lib/ruptr/timing_cache.rb
|
|
54
54
|
- lib/ruptr/tty_colors.rb
|
|
55
55
|
- lib/ruptr/utils.rb
|
|
56
|
+
homepage: https://github.com/Math2/ruptr
|
|
56
57
|
licenses:
|
|
57
58
|
- MIT
|
|
58
59
|
metadata: {}
|