minitest 5.10.3 → 5.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +193 -4
- data/Manifest.txt +1 -0
- data/README.rdoc +87 -14
- data/Rakefile +4 -16
- data/lib/hoe/minitest.rb +0 -4
- data/lib/minitest/assertions.rb +145 -32
- data/lib/minitest/benchmark.rb +34 -3
- data/lib/minitest/expectations.rb +54 -35
- data/lib/minitest/mock.rb +11 -10
- data/lib/minitest/parallel.rb +1 -1
- data/lib/minitest/spec.rb +20 -8
- data/lib/minitest/test.rb +15 -69
- data/lib/minitest.rb +241 -31
- data/test/minitest/metametameta.rb +43 -8
- data/test/minitest/test_minitest_assertions.rb +1588 -0
- data/test/minitest/test_minitest_mock.rb +380 -7
- data/test/minitest/test_minitest_reporter.rb +45 -21
- data/test/minitest/test_minitest_spec.rb +220 -143
- data/test/minitest/test_minitest_test.rb +119 -1120
- data.tar.gz.sig +0 -0
- metadata +34 -24
- metadata.gz.sig +0 -0
@@ -6,8 +6,27 @@ class Minitest::Test
|
|
6
6
|
def clean s
|
7
7
|
s.gsub(/^ {6}/, "")
|
8
8
|
end
|
9
|
+
|
10
|
+
def with_empty_backtrace_filter
|
11
|
+
original = Minitest.backtrace_filter
|
12
|
+
|
13
|
+
obj = Minitest::BacktraceFilter.new
|
14
|
+
def obj.filter _bt
|
15
|
+
[]
|
16
|
+
end
|
17
|
+
|
18
|
+
Minitest::Test.io_lock.synchronize do # try not to trounce in parallel
|
19
|
+
begin
|
20
|
+
Minitest.backtrace_filter = obj
|
21
|
+
yield
|
22
|
+
ensure
|
23
|
+
Minitest.backtrace_filter = original
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
9
27
|
end
|
10
28
|
|
29
|
+
|
11
30
|
class FakeNamedTest < Minitest::Test
|
12
31
|
@@count = 0
|
13
32
|
|
@@ -19,9 +38,20 @@ class FakeNamedTest < Minitest::Test
|
|
19
38
|
end
|
20
39
|
end
|
21
40
|
|
41
|
+
module MyModule; end
|
42
|
+
class AnError < StandardError; include MyModule; end
|
43
|
+
|
22
44
|
class MetaMetaMetaTestCase < Minitest::Test
|
23
45
|
attr_accessor :reporter, :output, :tu
|
24
46
|
|
47
|
+
def with_stderr err
|
48
|
+
old = $stderr
|
49
|
+
$stderr = err
|
50
|
+
yield
|
51
|
+
ensure
|
52
|
+
$stderr = old
|
53
|
+
end
|
54
|
+
|
25
55
|
def run_tu_with_fresh_reporter flags = %w[--seed 42]
|
26
56
|
options = Minitest.process_args flags
|
27
57
|
|
@@ -31,18 +61,20 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
31
61
|
reporter << Minitest::SummaryReporter.new(@output, options)
|
32
62
|
reporter << Minitest::ProgressReporter.new(@output, options)
|
33
63
|
|
34
|
-
|
64
|
+
with_stderr @output do
|
65
|
+
reporter.start
|
35
66
|
|
36
|
-
|
67
|
+
yield(reporter) if block_given?
|
37
68
|
|
38
|
-
|
39
|
-
|
40
|
-
|
69
|
+
@tus ||= [@tu]
|
70
|
+
@tus.each do |tu|
|
71
|
+
Minitest::Runnable.runnables.delete tu
|
41
72
|
|
42
|
-
|
43
|
-
|
73
|
+
tu.run reporter, options
|
74
|
+
end
|
44
75
|
|
45
|
-
|
76
|
+
reporter.report
|
77
|
+
end
|
46
78
|
end
|
47
79
|
|
48
80
|
def first_reporter
|
@@ -68,6 +100,7 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
68
100
|
output.sub!(/Finished in .*/, "Finished in 0.00")
|
69
101
|
output.sub!(/Loaded suite .*/, "Loaded suite blah")
|
70
102
|
|
103
|
+
output.gsub!(/FakeNamedTest\d+/, "FakeNamedTestXX")
|
71
104
|
output.gsub!(/ = \d+.\d\d s = /, " = 0.00 s = ")
|
72
105
|
output.gsub!(/0x[A-Fa-f0-9]+/, "0xXXX")
|
73
106
|
output.gsub!(/ +$/, "")
|
@@ -80,6 +113,8 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
80
113
|
output.gsub!(/^(\s+)[^:]+:\d+:in/, '\1FILE:LINE:in')
|
81
114
|
end
|
82
115
|
|
116
|
+
output.gsub!(/( at )[^:]+:\d+/, '\1[FILE:LINE]')
|
117
|
+
|
83
118
|
output
|
84
119
|
end
|
85
120
|
|