minitest 5.20.0 → 5.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +130 -3
- data/Manifest.txt +3 -0
- data/README.rdoc +16 -13
- data/Rakefile +6 -0
- data/lib/hoe/minitest.rb +2 -1
- data/lib/minitest/assertions.rb +77 -80
- data/lib/minitest/autorun.rb +0 -7
- data/lib/minitest/benchmark.rb +6 -9
- data/lib/minitest/compress.rb +94 -0
- data/lib/minitest/error_on_warning.rb +11 -0
- data/lib/minitest/manual_plugins.rb +16 -0
- data/lib/minitest/mock.rb +17 -15
- data/lib/minitest/parallel.rb +5 -5
- data/lib/minitest/pride_plugin.rb +16 -23
- data/lib/minitest/spec.rb +5 -5
- data/lib/minitest/test.rb +14 -25
- data/lib/minitest/test_task.rb +17 -12
- data/lib/minitest.rb +257 -144
- data/test/minitest/metametameta.rb +32 -18
- data/test/minitest/test_minitest_assertions.rb +159 -140
- data/test/minitest/test_minitest_benchmark.rb +1 -1
- data/test/minitest/test_minitest_mock.rb +80 -75
- data/test/minitest/test_minitest_reporter.rb +111 -16
- data/test/minitest/test_minitest_spec.rb +54 -55
- data/test/minitest/test_minitest_test.rb +191 -117
- data/test/minitest/test_minitest_test_task.rb +18 -7
- data.tar.gz.sig +0 -0
- metadata +17 -13
- metadata.gz.sig +0 -0
@@ -3,29 +3,38 @@ require "stringio"
|
|
3
3
|
require "minitest/autorun"
|
4
4
|
|
5
5
|
class Minitest::Test
|
6
|
-
def
|
7
|
-
|
6
|
+
def with_empty_backtrace_filter
|
7
|
+
with_backtrace_filter Minitest::BacktraceFilter.new %r%.% do
|
8
|
+
yield
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
|
-
def
|
12
|
+
def with_backtrace_filter filter
|
11
13
|
original = Minitest.backtrace_filter
|
12
14
|
|
13
|
-
obj = Minitest::BacktraceFilter.new
|
14
|
-
def obj.filter _bt
|
15
|
-
[]
|
16
|
-
end
|
17
|
-
|
18
15
|
Minitest::Test.io_lock.synchronize do # try not to trounce in parallel
|
19
16
|
begin
|
20
|
-
Minitest.backtrace_filter =
|
17
|
+
Minitest.backtrace_filter = filter
|
21
18
|
yield
|
22
19
|
ensure
|
23
20
|
Minitest.backtrace_filter = original
|
24
21
|
end
|
25
22
|
end
|
26
23
|
end
|
27
|
-
end
|
28
24
|
|
25
|
+
def error_on_warn?
|
26
|
+
defined?(Minitest::ErrorOnWarning)
|
27
|
+
end
|
28
|
+
|
29
|
+
def assert_deprecation re = /DEPRECATED/
|
30
|
+
re = // if $-w.nil? # "skip" if running `rake testW0`
|
31
|
+
assert_output "", re do
|
32
|
+
yield
|
33
|
+
end
|
34
|
+
rescue Minitest::UnexpectedWarning => e # raised if -Werror was used
|
35
|
+
assert_match re, e.message
|
36
|
+
end
|
37
|
+
end
|
29
38
|
|
30
39
|
class FakeNamedTest < Minitest::Test
|
31
40
|
@@count = 0
|
@@ -55,7 +64,7 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
55
64
|
def run_tu_with_fresh_reporter flags = %w[--seed 42]
|
56
65
|
options = Minitest.process_args flags
|
57
66
|
|
58
|
-
@output = StringIO.new(""
|
67
|
+
@output = StringIO.new(+"")
|
59
68
|
|
60
69
|
self.reporter = Minitest::CompositeReporter.new
|
61
70
|
reporter << Minitest::SummaryReporter.new(@output, options)
|
@@ -64,7 +73,7 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
64
73
|
with_stderr @output do
|
65
74
|
reporter.start
|
66
75
|
|
67
|
-
yield
|
76
|
+
yield reporter if block_given?
|
68
77
|
|
69
78
|
@tus ||= [@tu]
|
70
79
|
@tus.each do |tu|
|
@@ -82,8 +91,8 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
82
91
|
end
|
83
92
|
|
84
93
|
def assert_report expected, flags = %w[--seed 42], &block
|
85
|
-
header =
|
86
|
-
Run options: #{flags.map { |s| s
|
94
|
+
header = <<~EOM
|
95
|
+
Run options: #{flags.map { |s| s.include?("|") ? s.inspect : s }.join " "}
|
87
96
|
|
88
97
|
# Running:
|
89
98
|
|
@@ -105,15 +114,20 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
105
114
|
output.gsub!(/0x[A-Fa-f0-9]+/, "0xXXX")
|
106
115
|
output.gsub!(/ +$/, "")
|
107
116
|
|
117
|
+
file = ->(s) { s.start_with?("/") ? "FULLFILE" : "FILE" }
|
118
|
+
|
108
119
|
if windows? then
|
109
120
|
output.gsub!(/\[(?:[A-Za-z]:)?[^\]:]+:\d+\]/, "[FILE:LINE]")
|
110
|
-
output.gsub!(/^(\s+)(?:[A-Za-z]:)?[^:]+:\d+:in/, '\1FILE:LINE:in')
|
121
|
+
output.gsub!(/^(\s+)(?:[A-Za-z]:)?[^:]+:\d+:in [`']/, '\1FILE:LINE:in \'')
|
111
122
|
else
|
112
|
-
output.gsub!(/\[[^\]:]
|
113
|
-
output.gsub!(/^(\s+)[^:]
|
123
|
+
output.gsub!(/\[([^\]:]+):\d+\]/) { "[#{file[$1]}:LINE]" }
|
124
|
+
output.gsub!(/^(\s+)([^:]+):\d+:in [`']/) { "#{$1}#{file[$2]}:LINE:in '" }
|
114
125
|
end
|
115
126
|
|
116
|
-
output.gsub!(/
|
127
|
+
output.gsub!(/in [`']block in (?:([^']+)[#.])?/, "in 'block in")
|
128
|
+
output.gsub!(/in [`'](?:([^']+)[#.])?/, "in '")
|
129
|
+
|
130
|
+
output.gsub!(/( at )([^:]+):\d+/) { "#{$1}[#{file[$2]}:LINE]" } # eval?
|
117
131
|
|
118
132
|
output
|
119
133
|
end
|