minitest 5.22.3 → 5.24.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 +42 -0
- data/Manifest.txt +2 -0
- data/README.rdoc +15 -13
- data/Rakefile +6 -0
- data/lib/minitest/autorun.rb +0 -7
- data/lib/minitest/error_on_warning.rb +11 -0
- data/lib/minitest/manual_plugins.rb +16 -0
- data/lib/minitest/parallel.rb +1 -1
- data/lib/minitest/test_task.rb +8 -2
- data/lib/minitest.rb +155 -93
- data/test/minitest/metametameta.rb +13 -2
- data/test/minitest/test_minitest_assertions.rb +20 -21
- data/test/minitest/test_minitest_mock.rb +13 -11
- data/test/minitest/test_minitest_reporter.rb +1 -1
- data/test/minitest/test_minitest_spec.rb +19 -17
- data/test/minitest/test_minitest_test.rb +5 -5
- data/test/minitest/test_minitest_test_task.rb +7 -1
- data.tar.gz.sig +0 -0
- metadata +5 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6452667dd5b1b7c8a083aebc718437613071b7b544b10d6974bc82d1236c900
|
4
|
+
data.tar.gz: 452965ff5a2b9e852174b81a9b762818da296869507ba1d16e6106bfe40c913b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f98fdc87bd639f427d527552ed131233f31d9096e97643150df0bd732700070180cf2cb4a278531bd53faa780769404f606f35ea04ac44bf81652a700df20c3d
|
7
|
+
data.tar.gz: a1d99a1cdb10b6629e34e76848de7301e80ef85280a54629ca225bb1b9a0e644f83f2b43d51a39d21c97c6da8da47d23c5a96cf3fcc90088a63fe448097b287b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,45 @@
|
|
1
|
+
=== 5.24.0 / 2024-06-18
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Added Minitest.register_plugin.
|
6
|
+
* Extended plugin system to work with modules/classes for opt-out plugins.
|
7
|
+
|
8
|
+
* 1 bug fix:
|
9
|
+
|
10
|
+
* Removed anacronism, but allow load_plugins to exit gracefully if --disable=gems.
|
11
|
+
|
12
|
+
=== 5.23.1 / 2024-05-21
|
13
|
+
|
14
|
+
* 1 bug fix:
|
15
|
+
|
16
|
+
* Fully qualify the Queue class to avoid conflicts with other libraries. (rafaelfranca)
|
17
|
+
|
18
|
+
=== 5.23.0 / 2024-05-15
|
19
|
+
|
20
|
+
* 3 minor enhancements:
|
21
|
+
|
22
|
+
* Added -Werror to raise on any warning output. (byroot)
|
23
|
+
* Added UnexpectedWarning as a failure summary type, added count to output if activated.
|
24
|
+
* Added minitest/manual_plugins.rb w/ new Minitest.load method. (tenderlove)
|
25
|
+
|
26
|
+
* 2 bug fixes:
|
27
|
+
|
28
|
+
* Allow empty_run! and reporter to display summary for empty runs. (zzak)
|
29
|
+
* Make test task verbose using either rake's -v or -t (was just -t).
|
30
|
+
|
31
|
+
=== 5.22.3 / 2024-03-13
|
32
|
+
|
33
|
+
* 1 minor enhancement:
|
34
|
+
|
35
|
+
* MASSIVE improvement of minitest's pride plugin output: Frequencies doubled! Sine waves shifted!! Comments improved!!! Colors rotated!!!! (havenwood)
|
36
|
+
|
37
|
+
* 3 bug fixes:
|
38
|
+
|
39
|
+
* Improved wording on Minitest::Test#parallelize_me! to clarify it goes INSIDE your test class/describe.
|
40
|
+
* Minor changes to tests to pass when tests ran with extra flags (eg -p).
|
41
|
+
* Support Ruby 3.4's new error message format. (mame)
|
42
|
+
|
1
43
|
=== 5.22.2 / 2024-02-07
|
2
44
|
|
3
45
|
* 1 bug fix:
|
data/Manifest.txt
CHANGED
@@ -10,8 +10,10 @@ lib/minitest/assertions.rb
|
|
10
10
|
lib/minitest/autorun.rb
|
11
11
|
lib/minitest/benchmark.rb
|
12
12
|
lib/minitest/compress.rb
|
13
|
+
lib/minitest/error_on_warning.rb
|
13
14
|
lib/minitest/expectations.rb
|
14
15
|
lib/minitest/hell.rb
|
16
|
+
lib/minitest/manual_plugins.rb
|
15
17
|
lib/minitest/mock.rb
|
16
18
|
lib/minitest/parallel.rb
|
17
19
|
lib/minitest/pride.rb
|
data/README.rdoc
CHANGED
@@ -406,22 +406,23 @@ Using our example above, here is how we might implement MyCI:
|
|
406
406
|
|
407
407
|
=== What versions are compatible with what? Or what versions are supported?
|
408
408
|
|
409
|
-
Minitest is a dependency of rails, which until
|
409
|
+
Minitest is a dependency of rails, which until very recently had an
|
410
410
|
overzealous backwards compatibility policy. As such, I'm stuck
|
411
411
|
supporting versions of ruby that are long past EOL. Hopefully I'll be
|
412
412
|
able to support only current versions of ruby sometime in the near
|
413
413
|
future.
|
414
414
|
|
415
|
-
(As of
|
415
|
+
(As of 2024-05-10)
|
416
416
|
|
417
417
|
Current versions of rails: (https://endoflife.date/rails)
|
418
418
|
|
419
|
-
| rails | min ruby |
|
420
|
-
|
421
|
-
| 7.
|
422
|
-
|
|
423
|
-
| 6.
|
424
|
-
|
|
419
|
+
| rails | min ruby | minitest | status | EOL Date |
|
420
|
+
|-------+----------+----------+----------+------------|
|
421
|
+
| 7.1 | >= 2.7 | >= 5.1 | Current | 2026-06-01?|
|
422
|
+
| 7.0 | >= 2.7 | >= 5.1 | Maint | 2025-06-01?|
|
423
|
+
| 6.1 | >= 2.5 | >= 5.1 | Security | 2024-06-01?|
|
424
|
+
| 6.0 | >= 2.5 | >= 5.1 | EOL | 2023-06-01 |
|
425
|
+
| 5.2 | >= 2.2.2 | ~> 5.1 | EOL | 2022-06-01 |
|
425
426
|
|
426
427
|
If you want to look at the requirements for a specific version, run:
|
427
428
|
|
@@ -431,12 +432,13 @@ Current versions of ruby: (https://endoflife.date/ruby)
|
|
431
432
|
|
432
433
|
| ruby | Status | EOL Date |
|
433
434
|
|------+---------+------------|
|
434
|
-
| 3.
|
435
|
-
| 3.
|
436
|
-
| 3.
|
437
|
-
|
|
435
|
+
| 3.3 | Current | 2027-03-31 |
|
436
|
+
| 3.2 | Maint | 2026-03-31 |
|
437
|
+
| 3.1 | Security| 2025-03-31 |
|
438
|
+
| 3.0 | EOL | 2024-03-31 |
|
439
|
+
| 2.7 | EOL | 2023-03-31 |
|
438
440
|
| 2.6 | EOL | 2022-03-31 |
|
439
|
-
| 2.5 | EOL | 2021-03-31 |
|
441
|
+
| 2.5 | EOL | 2021-03-31 | DO YOU SEE WHAT I'M STUCK WITH???
|
440
442
|
|
441
443
|
=== How to test SimpleDelegates?
|
442
444
|
|
data/Rakefile
CHANGED
@@ -33,6 +33,7 @@ task :specs do
|
|
33
33
|
/_includes/ => "_include",
|
34
34
|
/(must|wont)_(.*_of|nil|silent|empty)/ => '\1_be_\2',
|
35
35
|
/must_raises/ => "must_raise",
|
36
|
+
/(must|wont)_pattern/ => '\1_pattern_match',
|
36
37
|
/(must|wont)_predicate/ => '\1_be',
|
37
38
|
/(must|wont)_path_exists/ => 'path_\1_exist',
|
38
39
|
}
|
@@ -72,4 +73,9 @@ task :bugs do
|
|
72
73
|
sh "for f in bug*.rb ; do echo $f; echo; #{Gem.ruby} -Ilib $f && rm $f ; done"
|
73
74
|
end
|
74
75
|
|
76
|
+
Minitest::TestTask.create :testW0 do |t|
|
77
|
+
t.warning = false
|
78
|
+
t.test_prelude = "$-w = nil"
|
79
|
+
end
|
80
|
+
|
75
81
|
# vim: syntax=Ruby
|
data/lib/minitest/autorun.rb
CHANGED
data/lib/minitest/parallel.rb
CHANGED
data/lib/minitest/test_task.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require "shellwords"
|
2
2
|
require "rbconfig"
|
3
|
-
|
3
|
+
|
4
|
+
begin
|
5
|
+
require "rake/tasklib"
|
6
|
+
rescue LoadError => e
|
7
|
+
warn e.message
|
8
|
+
return
|
9
|
+
end
|
4
10
|
|
5
11
|
module Minitest # :nodoc:
|
6
12
|
|
@@ -114,7 +120,7 @@ module Minitest # :nodoc:
|
|
114
120
|
self.test_globs = ["test/**/test_*.rb",
|
115
121
|
"test/**/*_test.rb"]
|
116
122
|
self.test_prelude = nil
|
117
|
-
self.verbose = Rake.application.options.trace
|
123
|
+
self.verbose = Rake.application.options.trace || Rake.verbose == true
|
118
124
|
self.warning = true
|
119
125
|
end
|
120
126
|
|
data/lib/minitest.rb
CHANGED
@@ -9,7 +9,7 @@ require_relative "minitest/compress"
|
|
9
9
|
# :include: README.rdoc
|
10
10
|
|
11
11
|
module Minitest
|
12
|
-
VERSION = "5.
|
12
|
+
VERSION = "5.24.0" # :nodoc:
|
13
13
|
|
14
14
|
@@installed_at_exit ||= false
|
15
15
|
@@after_run = []
|
@@ -98,20 +98,19 @@ module Minitest
|
|
98
98
|
@@after_run << block
|
99
99
|
end
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
##
|
102
|
+
# Register a plugin to be used. Does NOT require / load it.
|
103
|
+
|
104
|
+
def self.register_plugin name_or_mod
|
105
|
+
self.extensions << name_or_mod
|
106
|
+
nil
|
106
107
|
end
|
107
108
|
|
108
109
|
def self.load_plugins # :nodoc:
|
109
|
-
return unless
|
110
|
+
return unless defined? Gem
|
110
111
|
|
111
112
|
seen = {}
|
112
113
|
|
113
|
-
require "rubygems" unless defined? Gem
|
114
|
-
|
115
114
|
Gem.find_files("minitest/*_plugin.rb").each do |plugin_path|
|
116
115
|
name = File.basename plugin_path, "_plugin.rb"
|
117
116
|
|
@@ -123,6 +122,130 @@ module Minitest
|
|
123
122
|
end
|
124
123
|
end
|
125
124
|
|
125
|
+
def self.init_plugins options # :nodoc:
|
126
|
+
self.extensions.each do |mod_or_meth|
|
127
|
+
case mod_or_meth
|
128
|
+
when Symbol, String then
|
129
|
+
name = mod_or_meth
|
130
|
+
msg = "plugin_#{name}_init"
|
131
|
+
next unless self.respond_to? msg
|
132
|
+
send msg, options
|
133
|
+
when Module then
|
134
|
+
recv = mod_or_meth
|
135
|
+
next unless recv.respond_to? :minitest_plugin_init
|
136
|
+
recv.minitest_plugin_init options
|
137
|
+
else
|
138
|
+
raise ArgumentError, "plugin is %p, but it must be a symbol, string or module" % [mod_or_meth]
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def self.process_args args = [] # :nodoc:
|
144
|
+
options = {
|
145
|
+
:io => $stdout,
|
146
|
+
}
|
147
|
+
orig_args = args.dup
|
148
|
+
|
149
|
+
OptionParser.new do |opts|
|
150
|
+
opts.banner = "minitest options:"
|
151
|
+
opts.version = Minitest::VERSION
|
152
|
+
|
153
|
+
opts.on "-h", "--help", "Display this help." do
|
154
|
+
puts opts
|
155
|
+
exit
|
156
|
+
end
|
157
|
+
|
158
|
+
opts.on "--no-plugins", "Bypass minitest plugin auto-loading (or set $MT_NO_PLUGINS)."
|
159
|
+
|
160
|
+
desc = "Sets random seed. Also via env. Eg: SEED=n rake"
|
161
|
+
opts.on "-s", "--seed SEED", Integer, desc do |m|
|
162
|
+
options[:seed] = m.to_i
|
163
|
+
end
|
164
|
+
|
165
|
+
opts.on "-v", "--verbose", "Verbose. Show progress processing files." do
|
166
|
+
options[:verbose] = true
|
167
|
+
end
|
168
|
+
|
169
|
+
opts.on "-q", "--quiet", "Quiet. Show no progress processing files." do
|
170
|
+
options[:quiet] = true
|
171
|
+
end
|
172
|
+
|
173
|
+
opts.on "--show-skips", "Show skipped at the end of run." do
|
174
|
+
options[:show_skips] = true
|
175
|
+
end
|
176
|
+
|
177
|
+
opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a|
|
178
|
+
options[:filter] = a
|
179
|
+
end
|
180
|
+
|
181
|
+
opts.on "-e", "--exclude PATTERN", "Exclude /regexp/ or string from run." do |a|
|
182
|
+
options[:exclude] = a
|
183
|
+
end
|
184
|
+
|
185
|
+
opts.on "-S", "--skip CODES", String, "Skip reporting of certain types of results (eg E)." do |s|
|
186
|
+
options[:skip] = s.chars.to_a
|
187
|
+
end
|
188
|
+
|
189
|
+
ruby27plus = ::Warning.respond_to?(:[]=)
|
190
|
+
|
191
|
+
opts.on "-W[error]", String, "Turn Ruby warnings into errors" do |s|
|
192
|
+
options[:Werror] = true
|
193
|
+
case s
|
194
|
+
when "error", "all", nil then
|
195
|
+
require "minitest/error_on_warning"
|
196
|
+
$VERBOSE = true
|
197
|
+
::Warning[:deprecated] = true if ruby27plus
|
198
|
+
else
|
199
|
+
::Warning[s.to_sym] = true if ruby27plus # check validity of category
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
unless extensions.empty?
|
204
|
+
opts.separator ""
|
205
|
+
opts.separator "Known extensions: #{extensions.join(", ")}"
|
206
|
+
|
207
|
+
extensions.each do |mod_or_meth|
|
208
|
+
case mod_or_meth
|
209
|
+
when Symbol, String then
|
210
|
+
meth = mod_or_meth
|
211
|
+
msg = "plugin_#{meth}_options"
|
212
|
+
send msg, opts, options if respond_to?(msg)
|
213
|
+
when Module
|
214
|
+
recv = mod_or_meth
|
215
|
+
next unless recv.respond_to? :minitest_plugin_options
|
216
|
+
recv.minitest_plugin_options opts, options
|
217
|
+
else
|
218
|
+
raise ArgumentError, "plugin is %p, but it must be a symbol, string or module" % [mod_or_meth]
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
begin
|
224
|
+
opts.parse! args
|
225
|
+
rescue OptionParser::InvalidOption => e
|
226
|
+
puts
|
227
|
+
puts e
|
228
|
+
puts
|
229
|
+
puts opts
|
230
|
+
exit 1
|
231
|
+
end
|
232
|
+
|
233
|
+
orig_args -= args
|
234
|
+
end
|
235
|
+
|
236
|
+
unless options[:seed] then
|
237
|
+
srand
|
238
|
+
options[:seed] = (ENV["SEED"] || srand).to_i % 0xFFFF
|
239
|
+
orig_args << "--seed" << options[:seed].to_s
|
240
|
+
end
|
241
|
+
|
242
|
+
options[:args] = orig_args.map { |s|
|
243
|
+
s =~ /[\s|&<>$()]/ ? s.inspect : s
|
244
|
+
}.join " "
|
245
|
+
|
246
|
+
options
|
247
|
+
end
|
248
|
+
|
126
249
|
##
|
127
250
|
# This is the top-level run method. Everything starts from here. It
|
128
251
|
# tells each Runnable sub-class to run, and each of those are
|
@@ -132,6 +255,9 @@ module Minitest
|
|
132
255
|
#
|
133
256
|
# Minitest.autorun
|
134
257
|
# Minitest.run(args)
|
258
|
+
# Minitest.load_plugins
|
259
|
+
# Minitest.process_args
|
260
|
+
# Minitest.init_plugins
|
135
261
|
# Minitest.__run(reporter, options)
|
136
262
|
# Runnable.runnables.each
|
137
263
|
# runnable_klass.run(reporter, options)
|
@@ -167,10 +293,10 @@ module Minitest
|
|
167
293
|
|
168
294
|
# might have been removed/replaced during init_plugins:
|
169
295
|
summary = reporter.reporters.grep(SummaryReporter).first
|
170
|
-
return empty_run! options if summary && summary.count == 0
|
171
296
|
|
172
297
|
reporter.report
|
173
298
|
|
299
|
+
return empty_run! options if summary && summary.count == 0
|
174
300
|
reporter.passed?
|
175
301
|
end
|
176
302
|
|
@@ -207,88 +333,6 @@ module Minitest
|
|
207
333
|
parallel.map { |suite| suite.run reporter, options }
|
208
334
|
end
|
209
335
|
|
210
|
-
def self.process_args args = [] # :nodoc:
|
211
|
-
options = {
|
212
|
-
:io => $stdout,
|
213
|
-
}
|
214
|
-
orig_args = args.dup
|
215
|
-
|
216
|
-
OptionParser.new do |opts|
|
217
|
-
opts.banner = "minitest options:"
|
218
|
-
opts.version = Minitest::VERSION
|
219
|
-
|
220
|
-
opts.on "-h", "--help", "Display this help." do
|
221
|
-
puts opts
|
222
|
-
exit
|
223
|
-
end
|
224
|
-
|
225
|
-
opts.on "--no-plugins", "Bypass minitest plugin auto-loading (or set $MT_NO_PLUGINS)."
|
226
|
-
|
227
|
-
desc = "Sets random seed. Also via env. Eg: SEED=n rake"
|
228
|
-
opts.on "-s", "--seed SEED", Integer, desc do |m|
|
229
|
-
options[:seed] = m.to_i
|
230
|
-
end
|
231
|
-
|
232
|
-
opts.on "-v", "--verbose", "Verbose. Show progress processing files." do
|
233
|
-
options[:verbose] = true
|
234
|
-
end
|
235
|
-
|
236
|
-
opts.on "-q", "--quiet", "Quiet. Show no progress processing files." do
|
237
|
-
options[:quiet] = true
|
238
|
-
end
|
239
|
-
|
240
|
-
opts.on "--show-skips", "Show skipped at the end of run." do
|
241
|
-
options[:show_skips] = true
|
242
|
-
end
|
243
|
-
|
244
|
-
opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a|
|
245
|
-
options[:filter] = a
|
246
|
-
end
|
247
|
-
|
248
|
-
opts.on "-e", "--exclude PATTERN", "Exclude /regexp/ or string from run." do |a|
|
249
|
-
options[:exclude] = a
|
250
|
-
end
|
251
|
-
|
252
|
-
opts.on "-S", "--skip CODES", String, "Skip reporting of certain types of results (eg E)." do |s|
|
253
|
-
options[:skip] = s.chars.to_a
|
254
|
-
end
|
255
|
-
|
256
|
-
unless extensions.empty?
|
257
|
-
opts.separator ""
|
258
|
-
opts.separator "Known extensions: #{extensions.join(", ")}"
|
259
|
-
|
260
|
-
extensions.each do |meth|
|
261
|
-
msg = "plugin_#{meth}_options"
|
262
|
-
send msg, opts, options if self.respond_to?(msg)
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
begin
|
267
|
-
opts.parse! args
|
268
|
-
rescue OptionParser::InvalidOption => e
|
269
|
-
puts
|
270
|
-
puts e
|
271
|
-
puts
|
272
|
-
puts opts
|
273
|
-
exit 1
|
274
|
-
end
|
275
|
-
|
276
|
-
orig_args -= args
|
277
|
-
end
|
278
|
-
|
279
|
-
unless options[:seed] then
|
280
|
-
srand
|
281
|
-
options[:seed] = (ENV["SEED"] || srand).to_i % 0xFFFF
|
282
|
-
orig_args << "--seed" << options[:seed].to_s
|
283
|
-
end
|
284
|
-
|
285
|
-
options[:args] = orig_args.map { |s|
|
286
|
-
s =~ /[\s|&<>$()]/ ? s.inspect : s
|
287
|
-
}.join " "
|
288
|
-
|
289
|
-
options
|
290
|
-
end
|
291
|
-
|
292
336
|
def self.filter_backtrace bt # :nodoc:
|
293
337
|
result = backtrace_filter.filter bt
|
294
338
|
result = bt.dup if result.empty?
|
@@ -782,6 +826,11 @@ module Minitest
|
|
782
826
|
|
783
827
|
attr_accessor :errors
|
784
828
|
|
829
|
+
##
|
830
|
+
# Total number of tests that warned.
|
831
|
+
|
832
|
+
attr_accessor :warnings
|
833
|
+
|
785
834
|
##
|
786
835
|
# Total number of tests that where skipped.
|
787
836
|
|
@@ -797,6 +846,7 @@ module Minitest
|
|
797
846
|
self.total_time = nil
|
798
847
|
self.failures = nil
|
799
848
|
self.errors = nil
|
849
|
+
self.warnings = nil
|
800
850
|
self.skips = nil
|
801
851
|
end
|
802
852
|
|
@@ -825,6 +875,7 @@ module Minitest
|
|
825
875
|
self.total_time = Minitest.clock_time - start_time
|
826
876
|
self.failures = aggregate[Assertion].size
|
827
877
|
self.errors = aggregate[UnexpectedError].size
|
878
|
+
self.warnings = aggregate[UnexpectedWarning].size
|
828
879
|
self.skips = aggregate[Skip].size
|
829
880
|
end
|
830
881
|
end
|
@@ -900,6 +951,8 @@ module Minitest
|
|
900
951
|
results.any?(&:skipped?) unless
|
901
952
|
options[:verbose] or options[:show_skips] or ENV["MT_NO_SKIP_MSG"]
|
902
953
|
|
954
|
+
extra.prepend ", %d warnings" % [warnings] if options[:Werror]
|
955
|
+
|
903
956
|
"%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
|
904
957
|
[count, assertions, failures, errors, skips, extra]
|
905
958
|
end
|
@@ -1034,6 +1087,15 @@ module Minitest
|
|
1034
1087
|
end
|
1035
1088
|
end
|
1036
1089
|
|
1090
|
+
##
|
1091
|
+
# Assertion raised on warning when running in -Werror mode.
|
1092
|
+
|
1093
|
+
class UnexpectedWarning < Assertion
|
1094
|
+
def result_label # :nodoc:
|
1095
|
+
"Warning"
|
1096
|
+
end
|
1097
|
+
end
|
1098
|
+
|
1037
1099
|
##
|
1038
1100
|
# Provides a simple set of guards that you can use in your tests
|
1039
1101
|
# to skip execution if it is not applicable. These methods are
|
@@ -1107,7 +1169,7 @@ module Minitest
|
|
1107
1169
|
|
1108
1170
|
class BacktraceFilter
|
1109
1171
|
|
1110
|
-
MT_RE = %r%lib/minitest% #:nodoc:
|
1172
|
+
MT_RE = %r%lib/minitest|internal:warning% #:nodoc:
|
1111
1173
|
|
1112
1174
|
attr_accessor :regexp
|
1113
1175
|
|
@@ -25,8 +25,19 @@ class Minitest::Test
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
end
|
29
28
|
|
29
|
+
def error_on_warn?
|
30
|
+
defined?(Minitest::ErrorOnWarning)
|
31
|
+
end
|
32
|
+
|
33
|
+
def assert_deprecation re = /DEPRECATED/
|
34
|
+
assert_output "", re do
|
35
|
+
yield
|
36
|
+
end
|
37
|
+
rescue Minitest::UnexpectedWarning => e # raised if -Werror was used
|
38
|
+
assert_match re, e.message
|
39
|
+
end
|
40
|
+
end
|
30
41
|
|
31
42
|
class FakeNamedTest < Minitest::Test
|
32
43
|
@@count = 0
|
@@ -56,7 +67,7 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
56
67
|
def run_tu_with_fresh_reporter flags = %w[--seed 42]
|
57
68
|
options = Minitest.process_args flags
|
58
69
|
|
59
|
-
@output = StringIO.new("".encode(
|
70
|
+
@output = StringIO.new("".encode(Encoding::UTF_8))
|
60
71
|
|
61
72
|
self.reporter = Minitest::CompositeReporter.new
|
62
73
|
reporter << Minitest::SummaryReporter.new(@output, options)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
require "minitest/autorun"
|
4
|
+
require_relative "metametameta"
|
4
5
|
|
5
6
|
if defined? Encoding then
|
6
7
|
e = Encoding.default_external
|
@@ -33,7 +34,6 @@ class TestMinitestAssertions < Minitest::Test
|
|
33
34
|
|
34
35
|
class DummyTest
|
35
36
|
include Minitest::Assertions
|
36
|
-
# include Minitest::Reportable # TODO: why do I really need this?
|
37
37
|
|
38
38
|
attr_accessor :assertions, :failure
|
39
39
|
|
@@ -58,15 +58,6 @@ class TestMinitestAssertions < Minitest::Test
|
|
58
58
|
"expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}")
|
59
59
|
end
|
60
60
|
|
61
|
-
def assert_deprecated name
|
62
|
-
dep = /DEPRECATED: #{name}. From #{__FILE__}:\d+(?::.*)?/
|
63
|
-
dep = "" if $-w.nil?
|
64
|
-
|
65
|
-
assert_output nil, dep do
|
66
|
-
yield
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
61
|
def assert_triggered expected, klass = Minitest::Assertion
|
71
62
|
e = assert_raises klass do
|
72
63
|
yield
|
@@ -301,7 +292,7 @@ class TestMinitestAssertions < Minitest::Test
|
|
301
292
|
err_re = /Use assert_nil if expecting nil from .*test_minitest_\w+.rb/
|
302
293
|
err_re = "" if $-w.nil?
|
303
294
|
|
304
|
-
|
295
|
+
assert_deprecation err_re do
|
305
296
|
@tc.assert_equal nil, nil
|
306
297
|
end
|
307
298
|
end
|
@@ -379,7 +370,7 @@ class TestMinitestAssertions < Minitest::Test
|
|
379
370
|
EOM
|
380
371
|
|
381
372
|
assert_triggered msg do
|
382
|
-
x = "bad-utf8-\xF1.txt".force_encoding
|
373
|
+
x = "bad-utf8-\xF1.txt".dup.force_encoding Encoding::ASCII
|
383
374
|
y = x.dup.force_encoding "binary" # TODO: switch to .b when 1.9 dropped
|
384
375
|
@tc.assert_equal x, y
|
385
376
|
end
|
@@ -966,8 +957,8 @@ class TestMinitestAssertions < Minitest::Test
|
|
966
957
|
@tc.assert_same 1, 2
|
967
958
|
end
|
968
959
|
|
969
|
-
s1 = "blah"
|
970
|
-
s2 = "blah"
|
960
|
+
s1 = +"blah"
|
961
|
+
s2 = +"blah"
|
971
962
|
|
972
963
|
assert_triggered 'Expected "blah" (oid=N) to be the same as "blah" (oid=N).' do
|
973
964
|
@tc.assert_same s1, s2
|
@@ -975,16 +966,24 @@ class TestMinitestAssertions < Minitest::Test
|
|
975
966
|
end
|
976
967
|
|
977
968
|
def test_assert_send
|
978
|
-
|
969
|
+
@assertion_count = 0 if error_on_warn?
|
970
|
+
assert_deprecation(/DEPRECATED: assert_send/) do
|
979
971
|
@tc.assert_send [1, :<, 2]
|
980
972
|
end
|
981
973
|
end
|
982
974
|
|
983
975
|
def test_assert_send_bad
|
984
|
-
|
985
|
-
|
976
|
+
if error_on_warn? then
|
977
|
+
@assertion_count = 0
|
978
|
+
assert_deprecation(/DEPRECATED: assert_send/) do
|
986
979
|
@tc.assert_send [1, :>, 2]
|
987
980
|
end
|
981
|
+
else
|
982
|
+
assert_triggered "Expected 1.>(*[2]) to return true." do
|
983
|
+
assert_deprecation(/DEPRECATED: assert_send/) do
|
984
|
+
@tc.assert_send [1, :>, 2]
|
985
|
+
end
|
986
|
+
end
|
988
987
|
end
|
989
988
|
end
|
990
989
|
|
@@ -1502,7 +1501,7 @@ class TestMinitestAssertions < Minitest::Test
|
|
1502
1501
|
d0 = Time.now
|
1503
1502
|
d1 = d0 + 86_400 # I am an idiot
|
1504
1503
|
|
1505
|
-
|
1504
|
+
assert_deprecation(/Stale skip_until \"not yet\" at .*?:\d+$/) do
|
1506
1505
|
assert_skip_until d0, "not yet"
|
1507
1506
|
end
|
1508
1507
|
|
@@ -1646,14 +1645,14 @@ class TestMinitestAssertionHelpers < Minitest::Test
|
|
1646
1645
|
end
|
1647
1646
|
|
1648
1647
|
def test_mu_pp_for_diff_str_bad_encoding
|
1649
|
-
str = "\666".force_encoding Encoding::UTF_8
|
1648
|
+
str = "\666".dup.force_encoding Encoding::UTF_8
|
1650
1649
|
exp = "# encoding: UTF-8\n# valid: false\n\"\\xB6\""
|
1651
1650
|
|
1652
1651
|
assert_mu_pp_for_diff exp, str, :raw
|
1653
1652
|
end
|
1654
1653
|
|
1655
1654
|
def test_mu_pp_for_diff_str_bad_encoding_both
|
1656
|
-
str = "\666A\\n\nB".force_encoding Encoding::UTF_8
|
1655
|
+
str = "\666A\\n\nB".dup.force_encoding Encoding::UTF_8
|
1657
1656
|
exp = "# encoding: UTF-8\n# valid: false\n\"\\xB6A\\\\n\\nB\""
|
1658
1657
|
|
1659
1658
|
assert_mu_pp_for_diff exp, str, :raw
|
@@ -1700,7 +1699,7 @@ class TestMinitestAssertionHelpers < Minitest::Test
|
|
1700
1699
|
end
|
1701
1700
|
|
1702
1701
|
def test_mu_pp_str_bad_encoding
|
1703
|
-
str = "\666".force_encoding Encoding::UTF_8
|
1702
|
+
str = "\666".dup.force_encoding Encoding::UTF_8
|
1704
1703
|
exp = "# encoding: UTF-8\n# valid: false\n\"\\xB6\""
|
1705
1704
|
|
1706
1705
|
assert_mu_pp exp, str, :raw
|
@@ -423,10 +423,12 @@ class TestMinitestMock < Minitest::Test
|
|
423
423
|
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
424
424
|
mock = Minitest::Mock.new
|
425
425
|
|
426
|
-
|
426
|
+
assert_deprecation(/Using MT_KWARGS_HAC. yet passing kwargs/) do
|
427
427
|
mock.expect :foo, nil, [{}], k1: arg1, k2: arg2, k3: arg3
|
428
428
|
end
|
429
429
|
|
430
|
+
skip "-Werror" if error_on_warn? # mock above raised, so this is dead
|
431
|
+
|
430
432
|
mock.foo({}, k1: arg1, k2: arg2, k3: arg3)
|
431
433
|
|
432
434
|
assert_mock mock
|
@@ -686,7 +688,7 @@ class TestMinitestStub < Minitest::Test
|
|
686
688
|
end
|
687
689
|
|
688
690
|
def test_stub_yield_self
|
689
|
-
obj = "foo"
|
691
|
+
obj = +"foo"
|
690
692
|
|
691
693
|
val = obj.stub :to_s, "bar" do |s|
|
692
694
|
s.to_s
|
@@ -816,7 +818,7 @@ class TestMinitestStub < Minitest::Test
|
|
816
818
|
# [:value, :block_call, :args] => N/A
|
817
819
|
|
818
820
|
class Bar
|
819
|
-
def call
|
821
|
+
def call(&_) # to ignore unused block
|
820
822
|
puts "hi"
|
821
823
|
end
|
822
824
|
end
|
@@ -956,7 +958,7 @@ class TestMinitestStub < Minitest::Test
|
|
956
958
|
def test_stub_lambda_block_call_5
|
957
959
|
@assertion_count += 1
|
958
960
|
rs = nil
|
959
|
-
io = StringIO.new
|
961
|
+
io = StringIO.new(+"", "w")
|
960
962
|
File.stub5 :open, lambda { |p, m, &blk| blk and blk.call io } do
|
961
963
|
File.open "foo.txt", "r" do |f|
|
962
964
|
rs = f && f.write("woot")
|
@@ -971,7 +973,7 @@ class TestMinitestStub < Minitest::Test
|
|
971
973
|
|
972
974
|
@assertion_count += 1
|
973
975
|
rs = nil
|
974
|
-
io = StringIO.new
|
976
|
+
io = StringIO.new(+"", "w")
|
975
977
|
File.stub6 :open, lambda { |p, m, &blk| blk.call io } do
|
976
978
|
File.open "foo.txt", "r" do |f|
|
977
979
|
rs = f.write("woot")
|
@@ -984,7 +986,7 @@ class TestMinitestStub < Minitest::Test
|
|
984
986
|
def test_stub_lambda_block_call_args_5
|
985
987
|
@assertion_count += 1
|
986
988
|
rs = nil
|
987
|
-
io = StringIO.new
|
989
|
+
io = StringIO.new(+"", "w")
|
988
990
|
File.stub5(:open, lambda { |p, m, &blk| blk and blk.call io }, :WTF?) do
|
989
991
|
File.open "foo.txt", "r" do |f|
|
990
992
|
rs = f.write("woot")
|
@@ -999,7 +1001,7 @@ class TestMinitestStub < Minitest::Test
|
|
999
1001
|
|
1000
1002
|
@assertion_count += 1
|
1001
1003
|
rs = nil
|
1002
|
-
io = StringIO.new
|
1004
|
+
io = StringIO.new(+"", "w")
|
1003
1005
|
File.stub6(:open, lambda { |p, m, &blk| blk.call io }, :WTF?) do
|
1004
1006
|
File.open "foo.txt", "r" do |f|
|
1005
1007
|
rs = f.write("woot")
|
@@ -1014,7 +1016,7 @@ class TestMinitestStub < Minitest::Test
|
|
1014
1016
|
|
1015
1017
|
@assertion_count += 2
|
1016
1018
|
rs = nil
|
1017
|
-
io = StringIO.new
|
1019
|
+
io = StringIO.new(+"", "w")
|
1018
1020
|
@tc.assert_raises ArgumentError do
|
1019
1021
|
File.stub6_2(:open, lambda { |p, m, &blk| blk.call io }, :WTF?) do
|
1020
1022
|
File.open "foo.txt", "r" do |f|
|
@@ -1064,7 +1066,7 @@ class TestMinitestStub < Minitest::Test
|
|
1064
1066
|
def test_stub_value_block_args_5
|
1065
1067
|
@assertion_count += 2
|
1066
1068
|
rs = nil
|
1067
|
-
io = StringIO.new
|
1069
|
+
io = StringIO.new(+"", "w")
|
1068
1070
|
File.stub5 :open, :value, io do
|
1069
1071
|
result = File.open "foo.txt", "r" do |f|
|
1070
1072
|
rs = f.write("woot")
|
@@ -1092,7 +1094,7 @@ class TestMinitestStub < Minitest::Test
|
|
1092
1094
|
|
1093
1095
|
@assertion_count += 2
|
1094
1096
|
rs = nil
|
1095
|
-
io = StringIO.new
|
1097
|
+
io = StringIO.new(+"", "w")
|
1096
1098
|
assert_deprecated do
|
1097
1099
|
File.stub6 :open, :value, io do
|
1098
1100
|
result = File.open "foo.txt", "r" do |f|
|
@@ -1110,7 +1112,7 @@ class TestMinitestStub < Minitest::Test
|
|
1110
1112
|
|
1111
1113
|
@assertion_count += 2
|
1112
1114
|
rs = nil
|
1113
|
-
io = StringIO.new
|
1115
|
+
io = StringIO.new(+"", "w")
|
1114
1116
|
@tc.assert_raises ArgumentError do
|
1115
1117
|
File.stub6_2 :open, :value, io do
|
1116
1118
|
result = File.open "foo.txt", "r" do |f|
|
@@ -284,18 +284,14 @@ describe Minitest::Spec do
|
|
284
284
|
end
|
285
285
|
|
286
286
|
it "needs to warn on equality with nil" do
|
287
|
-
@assertion_count
|
287
|
+
@assertion_count = 3
|
288
|
+
@assertion_count += 2 unless error_on_warn? # 2 extra assertions
|
289
|
+
|
290
|
+
exp = /DEPRECATED: Use assert_nil if expecting nil from .* This will fail in Minitest 6./
|
288
291
|
|
289
|
-
|
292
|
+
assert_deprecation exp do
|
290
293
|
assert_success _(nil).must_equal(nil)
|
291
294
|
end
|
292
|
-
|
293
|
-
exp = "DEPRECATED: Use assert_nil if expecting nil from #{__FILE__}:#{__LINE__-3}. " \
|
294
|
-
"This will fail in Minitest 6.\n"
|
295
|
-
exp = "" if $-w.nil?
|
296
|
-
|
297
|
-
assert_empty out
|
298
|
-
assert_equal exp, err
|
299
295
|
end
|
300
296
|
|
301
297
|
it "needs to verify floats outside a delta" do
|
@@ -576,7 +572,8 @@ describe Minitest::Spec do
|
|
576
572
|
|
577
573
|
it "can NOT use must_equal in a thread. It must use expect in a thread" do
|
578
574
|
skip "N/A" if ENV["MT_NO_EXPECTATIONS"]
|
579
|
-
|
575
|
+
|
576
|
+
assert_raises RuntimeError, Minitest::UnexpectedWarning do
|
580
577
|
capture_io do
|
581
578
|
Thread.new { (1 + 1).must_equal 2 }.join
|
582
579
|
end
|
@@ -586,9 +583,9 @@ describe Minitest::Spec do
|
|
586
583
|
it "fails gracefully when expectation used outside of `it`" do
|
587
584
|
skip "N/A" if ENV["MT_NO_EXPECTATIONS"]
|
588
585
|
|
589
|
-
@assertion_count +=
|
586
|
+
@assertion_count += 2 # assert_match is compound
|
590
587
|
|
591
|
-
e = assert_raises RuntimeError do
|
588
|
+
e = assert_raises RuntimeError, Minitest::UnexpectedWarning do
|
592
589
|
capture_io do
|
593
590
|
Thread.new { # forces ctx to be nil
|
594
591
|
describe("woot") do
|
@@ -598,17 +595,21 @@ describe Minitest::Spec do
|
|
598
595
|
end
|
599
596
|
end
|
600
597
|
|
601
|
-
|
598
|
+
exp = "Calling #must_equal outside of test."
|
599
|
+
exp = "DEPRECATED: global use of must_equal from" if error_on_warn?
|
600
|
+
|
601
|
+
assert_match exp, e.message
|
602
602
|
end
|
603
603
|
|
604
604
|
it "deprecates expectation used without _" do
|
605
605
|
skip "N/A" if ENV["MT_NO_EXPECTATIONS"]
|
606
606
|
|
607
|
-
@assertion_count +=
|
607
|
+
@assertion_count += 1
|
608
|
+
@assertion_count += 2 unless error_on_warn?
|
608
609
|
|
609
610
|
exp = /DEPRECATED: global use of must_equal from/
|
610
611
|
|
611
|
-
|
612
|
+
assert_deprecation exp do
|
612
613
|
(1 + 1).must_equal 2
|
613
614
|
end
|
614
615
|
end
|
@@ -618,12 +619,13 @@ describe Minitest::Spec do
|
|
618
619
|
it "deprecates expectation used without _ with empty backtrace_filter" do
|
619
620
|
skip "N/A" if ENV["MT_NO_EXPECTATIONS"]
|
620
621
|
|
621
|
-
@assertion_count +=
|
622
|
+
@assertion_count += 1
|
623
|
+
@assertion_count += 2 unless error_on_warn?
|
622
624
|
|
623
625
|
exp = /DEPRECATED: global use of must_equal from/
|
624
626
|
|
625
627
|
with_empty_backtrace_filter do
|
626
|
-
|
628
|
+
assert_deprecation exp do
|
627
629
|
(1 + 1).must_equal 2
|
628
630
|
end
|
629
631
|
end
|
@@ -94,7 +94,7 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def test_this_is_non_ascii_failure_message
|
97
|
-
fail 'ЁЁЁ'.force_encoding(
|
97
|
+
fail 'ЁЁЁ'.dup.force_encoding(Encoding::BINARY)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -1126,19 +1126,19 @@ class TestMinitestGuard < Minitest::Test
|
|
1126
1126
|
end
|
1127
1127
|
|
1128
1128
|
def test_rubinius_eh
|
1129
|
-
|
1129
|
+
assert_deprecation do
|
1130
1130
|
assert self.class.rubinius? "rbx"
|
1131
1131
|
end
|
1132
|
-
|
1132
|
+
assert_deprecation do
|
1133
1133
|
assert self.rubinius? "rbx"
|
1134
1134
|
end
|
1135
1135
|
end
|
1136
1136
|
|
1137
1137
|
def test_maglev_eh
|
1138
|
-
|
1138
|
+
assert_deprecation do
|
1139
1139
|
assert self.class.maglev? "maglev"
|
1140
1140
|
end
|
1141
|
-
|
1141
|
+
assert_deprecation do
|
1142
1142
|
assert self.maglev? "maglev"
|
1143
1143
|
end
|
1144
1144
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.24.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
S7043fq9EbQdBr2AXdj92+CDwuTfHI6/Hj5FVBDULufrJaan4xUgL70Hvc6pTTeW
|
30
30
|
deKfBjgVAq7EYHu1AczzlUly
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2024-
|
32
|
+
date: 2024-06-29 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
@@ -140,8 +140,10 @@ files:
|
|
140
140
|
- lib/minitest/autorun.rb
|
141
141
|
- lib/minitest/benchmark.rb
|
142
142
|
- lib/minitest/compress.rb
|
143
|
+
- lib/minitest/error_on_warning.rb
|
143
144
|
- lib/minitest/expectations.rb
|
144
145
|
- lib/minitest/hell.rb
|
146
|
+
- lib/minitest/manual_plugins.rb
|
145
147
|
- lib/minitest/mock.rb
|
146
148
|
- lib/minitest/parallel.rb
|
147
149
|
- lib/minitest/pride.rb
|
@@ -185,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
187
|
- !ruby/object:Gem::Version
|
186
188
|
version: '0'
|
187
189
|
requirements: []
|
188
|
-
rubygems_version: 3.5.
|
190
|
+
rubygems_version: 3.5.14
|
189
191
|
signing_key:
|
190
192
|
specification_version: 4
|
191
193
|
summary: minitest provides a complete suite of testing facilities supporting TDD,
|
metadata.gz.sig
CHANGED
Binary file
|