minitest 5.26.0 → 6.0.0

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/History.rdoc +95 -0
  4. data/Manifest.txt +13 -4
  5. data/README.rdoc +18 -98
  6. data/Rakefile +7 -1
  7. data/bin/minitest +5 -0
  8. data/design_rationale.rb +21 -19
  9. data/lib/hoe/minitest.rb +2 -1
  10. data/lib/minitest/assertions.rb +34 -66
  11. data/lib/minitest/autorun.rb +3 -4
  12. data/lib/minitest/benchmark.rb +2 -2
  13. data/lib/minitest/bisect.rb +306 -0
  14. data/lib/minitest/complete.rb +56 -0
  15. data/lib/minitest/find_minimal_combination.rb +127 -0
  16. data/lib/minitest/hell.rb +1 -1
  17. data/lib/minitest/manual_plugins.rb +4 -16
  18. data/lib/minitest/parallel.rb +5 -3
  19. data/lib/minitest/path_expander.rb +418 -0
  20. data/lib/minitest/pride.rb +2 -2
  21. data/lib/minitest/pride_plugin.rb +1 -1
  22. data/lib/minitest/server.rb +45 -0
  23. data/lib/minitest/server_plugin.rb +84 -0
  24. data/lib/minitest/spec.rb +5 -33
  25. data/lib/minitest/sprint.rb +104 -0
  26. data/lib/minitest/sprint_plugin.rb +39 -0
  27. data/lib/minitest/test.rb +7 -13
  28. data/lib/minitest/test_task.rb +6 -13
  29. data/lib/minitest.rb +86 -101
  30. data/test/minitest/metametameta.rb +1 -1
  31. data/test/minitest/test_bisect.rb +235 -0
  32. data/test/minitest/test_find_minimal_combination.rb +138 -0
  33. data/test/minitest/test_minitest_assertions.rb +48 -105
  34. data/test/minitest/test_minitest_reporter.rb +6 -5
  35. data/test/minitest/test_minitest_spec.rb +52 -118
  36. data/test/minitest/test_minitest_test.rb +21 -100
  37. data/test/minitest/test_path_expander.rb +229 -0
  38. data/test/minitest/test_server.rb +149 -0
  39. data.tar.gz.sig +1 -2
  40. metadata +50 -17
  41. metadata.gz.sig +2 -2
  42. data/.autotest +0 -34
  43. data/lib/minitest/mock.rb +0 -347
  44. data/lib/minitest/unit.rb +0 -42
  45. data/test/minitest/test_minitest_mock.rb +0 -1218
@@ -0,0 +1,104 @@
1
+ $LOAD_PATH.unshift "test", "lib"
2
+
3
+ require "simplecov" if ENV["MT_COV"] || ARGV.delete("--simplecov")
4
+ require_relative "autorun"
5
+ require_relative "path_expander"
6
+
7
+ ##
8
+ # Runs (Get it? It's fast!) your tests and makes it easier to rerun individual
9
+ # failures.
10
+
11
+ module Minitest
12
+ class Sprint
13
+ # extracted version = "1.5.0"
14
+
15
+ ##
16
+ # Process and run minitest cmdline.
17
+
18
+ def self.run args = ARGV
19
+ if ARGV.delete("--bisect") or ARGV.delete("-b") then
20
+ require_relative "bisect"
21
+
22
+ return Minitest::Bisect.run ARGV
23
+ end
24
+
25
+ Minitest::PathExpander.new(args).process { |f|
26
+ require "./#{f}" if File.file? f
27
+ }
28
+ end
29
+
30
+ ##
31
+ # An extra minitest reporter to output how to rerun failures in
32
+ # various styles.
33
+
34
+ class SprintReporter < AbstractReporter
35
+ ##
36
+ # The style to report, either lines or regexp. Defaults to lines.
37
+ attr_accessor :style
38
+ attr_accessor :results # :nodoc:
39
+
40
+ def initialize style = :regexp # :nodoc:
41
+ self.results = []
42
+ self.style = style
43
+ end
44
+
45
+ def record result # :nodoc:
46
+ results << result unless result.passed? or result.skipped?
47
+ end
48
+
49
+ def report # :nodoc:
50
+ return if results.empty?
51
+
52
+ puts
53
+ puts "Happy Happy Sprint List:"
54
+ puts
55
+ print_list
56
+ puts
57
+ end
58
+
59
+ def print_list # :nodoc:
60
+ case style
61
+ when :regexp
62
+ results.each do |result|
63
+ puts " minitest -n #{result.class_name}##{result.name}"
64
+ end
65
+ when :lines
66
+ files = Hash.new { |h,k| h[k] = [] }
67
+ results.each do |result|
68
+ path, line = result.source_location
69
+ path = path.delete_prefix "#{Dir.pwd}/"
70
+ files[path] << line
71
+ end
72
+
73
+ files.sort.each do |path, lines|
74
+ puts " minitest %s:%s" % [path, lines.sort.join(",")]
75
+ end
76
+ else
77
+ raise "unsupported style: %p" % [style]
78
+ end
79
+ end
80
+ end
81
+
82
+ ##
83
+ # An extra minitest reporter to output how to rerun failures using
84
+ # rake.
85
+
86
+ class RakeReporter < SprintReporter
87
+ ##
88
+ # The name of the rake task to rerun. Defaults to nil.
89
+
90
+ attr_accessor :name
91
+
92
+ def initialize name = nil # :nodoc:
93
+ super()
94
+ self.name = name
95
+ end
96
+
97
+ def print_list # :nodoc:
98
+ results.each do |result|
99
+ puts [" rake", name, "N=#{result.class_name}##{result.name}"].compact.join(" ")
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,39 @@
1
+ require_relative "../minitest"
2
+
3
+ # :stopdoc:
4
+ class OptionParser # unofficial embedded gem "makeoptparseworkwell"
5
+ def hidden(...) = define(...).tap { |sw| def sw.summarize(*) = nil }
6
+ def deprecate(from, to) = hidden(from) { abort "#{from} is deprecated. Use #{to}." }
7
+ def topdict(name) = name.length > 1 ? top.long : top.short
8
+ def alias(from, to) = (dict = topdict(from) and dict[to] = dict[from])
9
+ end unless OptionParser.method_defined? :hidden
10
+ # :startdoc:
11
+
12
+ module Minitest # :nodoc:
13
+ def self.plugin_sprint_options opts, options # :nodoc:
14
+ opts.on "--rake [TASK]", "Report how to re-run failures with rake." do |task|
15
+ options[:sprint] = :rake
16
+ options[:rake_task] = task
17
+ end
18
+
19
+ opts.deprecate "--binstub", "--rerun"
20
+
21
+ sprint_styles = %w[rake lines names binstub]
22
+
23
+ opts.on "-r", "--rerun [STYLE]", sprint_styles, "Report how to re-run failures using STYLE (names, lines)." do |style|
24
+ options[:sprint] = (style || :lines).to_sym
25
+ end
26
+ end
27
+
28
+ def self.plugin_sprint_init options
29
+ require_relative "sprint"
30
+ case options[:sprint]
31
+ when :rake then
32
+ self.reporter << Minitest::Sprint::RakeReporter.new(options[:rake_task])
33
+ when :binstub, :names then
34
+ self.reporter << Minitest::Sprint::SprintReporter.new
35
+ when :lines then
36
+ self.reporter << Minitest::Sprint::SprintReporter.new(:lines)
37
+ end
38
+ end
39
+ end
data/lib/minitest/test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "minitest" unless defined? Minitest::Runnable
1
+ require_relative "../minitest" unless defined? Minitest::Runnable
2
2
 
3
3
  module Minitest
4
4
  ##
@@ -8,14 +8,10 @@ module Minitest
8
8
  # See Minitest::Assertions
9
9
 
10
10
  class Test < Runnable
11
- require "minitest/assertions"
11
+ require_relative "assertions"
12
12
  include Minitest::Reportable
13
13
  include Minitest::Assertions
14
14
 
15
- def class_name # :nodoc:
16
- self.class.name # for Minitest::Reportable
17
- end
18
-
19
15
  PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException, SystemExit] # :nodoc:
20
16
 
21
17
  SETUP_METHODS = %w[ before_setup setup after_setup ] # :nodoc:
@@ -34,8 +30,8 @@ module Minitest
34
30
 
35
31
  def self.i_suck_and_my_tests_are_order_dependent!
36
32
  class << self
37
- undef_method :test_order if method_defined? :test_order
38
- define_method :test_order do :alpha end
33
+ undef_method :run_order if method_defined? :run_order
34
+ define_method :run_order do :alpha end
39
35
  end
40
36
  end
41
37
 
@@ -65,20 +61,20 @@ module Minitest
65
61
 
66
62
  ##
67
63
  # Returns all instance methods starting with "test_". Based on
68
- # #test_order, the methods are either sorted, randomized
64
+ # #run_order, the methods are either sorted, randomized
69
65
  # (default), or run in parallel.
70
66
 
71
67
  def self.runnable_methods
72
68
  methods = methods_matching(/^test_/)
73
69
 
74
- case self.test_order
70
+ case self.run_order
75
71
  when :random, :parallel then
76
72
  srand Minitest.seed
77
73
  methods.sort.shuffle
78
74
  when :alpha, :sorted then
79
75
  methods.sort
80
76
  else
81
- raise "Unknown test_order: #{self.test_order.inspect}"
77
+ raise "Unknown_order: %p" % [self.run_order]
82
78
  end
83
79
  end
84
80
 
@@ -234,5 +230,3 @@ module Minitest
234
230
  extend Guard
235
231
  end # Test
236
232
  end
237
-
238
- require "minitest/unit" if ENV["MT_COMPAT"] # compatibility layer only
@@ -168,20 +168,18 @@ module Minitest # :nodoc:
168
168
  ENV["TESTOPTS"]
169
169
  warn "FILTER is deprecated in Minitest::TestTask. Use A instead" if
170
170
  ENV["FILTER"]
171
- warn "N is deprecated in Minitest::TestTask. Use MT_CPU instead" if
172
- ENV["N"] && ENV["N"].to_i > 0
173
171
 
174
172
  lib_extras = (ENV["MT_LIB_EXTRAS"] || "").split File::PATH_SEPARATOR
175
173
  self.libs[0, 0] = lib_extras
176
174
 
177
- extra_args << "-n" << ENV["N"] if ENV["N"]
178
- extra_args << "-e" << ENV["X"] if ENV["X"]
175
+ extra_args << "-i" << ENV["N"] if ENV["N"]
176
+ extra_args << "-i" << ENV["I"] if ENV["I"]
177
+ extra_args << "-x" << ENV["X"] if ENV["X"]
178
+ extra_args << "-x" << ENV["E"] if ENV["E"]
179
179
  extra_args.concat Shellwords.split(ENV["TESTOPTS"]) if ENV["TESTOPTS"]
180
180
  extra_args.concat Shellwords.split(ENV["FILTER"]) if ENV["FILTER"]
181
181
  extra_args.concat Shellwords.split(ENV["A"]) if ENV["A"]
182
182
 
183
- ENV.delete "N" if ENV["N"]
184
-
185
183
  # TODO? RUBY_DEBUG = ENV["RUBY_DEBUG"]
186
184
  # TODO? ENV["RUBY_FLAGS"]
187
185
 
@@ -303,13 +301,8 @@ module Minitest # :nodoc:
303
301
  end
304
302
 
305
303
  class Work < Queue # :nodoc:
306
- def initialize jobs = [] # :nodoc:
307
- super()
308
-
309
- jobs.each do |job|
310
- self << job
311
- end
312
-
304
+ def initialize jobs # :nodoc:
305
+ super
313
306
  close
314
307
  end
315
308
  end
data/lib/minitest.rb CHANGED
@@ -10,7 +10,7 @@ require_relative "minitest/compress"
10
10
  # runtime. See +Minitest.run+ for more information.
11
11
 
12
12
  module Minitest
13
- VERSION = "5.26.0" # :nodoc:
13
+ VERSION = "6.0.0" # :nodoc:
14
14
 
15
15
  @@installed_at_exit ||= false
16
16
  @@after_run = []
@@ -33,8 +33,7 @@ module Minitest
33
33
 
34
34
  cattr_accessor :parallel_executor
35
35
 
36
- warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"] && ENV["N"].to_i > 0
37
- n_threads = (ENV["MT_CPU"] || ENV["N"] || Etc.nprocessors).to_i
36
+ n_threads = (ENV["MT_CPU"] || Etc.nprocessors).to_i
38
37
 
39
38
  self.parallel_executor = Parallel::Executor.new n_threads if n_threads > 1
40
39
 
@@ -68,8 +67,7 @@ module Minitest
68
67
  # Registers Minitest to run at process exit
69
68
 
70
69
  def self.autorun
71
- Warning[:deprecated] = true if
72
- Object.const_defined?(:Warning) && Warning.respond_to?(:[]=)
70
+ Warning[:deprecated] = true
73
71
 
74
72
  at_exit {
75
73
  next if $! and not ($!.kind_of? SystemExit and $!.success?)
@@ -98,6 +96,17 @@ module Minitest
98
96
  @@after_run << block
99
97
  end
100
98
 
99
+ ##
100
+ # Manually load plugins by name.
101
+
102
+ def self.load *names
103
+ names.each do |name|
104
+ require "minitest/#{name}_plugin"
105
+
106
+ self.extensions << name.to_s
107
+ end
108
+ end
109
+
101
110
  ##
102
111
  # Register a plugin to be used. Does NOT require / load it.
103
112
 
@@ -146,27 +155,33 @@ module Minitest
146
155
  }
147
156
  orig_args = args.dup
148
157
 
158
+ warn "--no-plugins is a no-op" if args.delete "--no-plugins" # TODO: remove me! when?
159
+
149
160
  OptionParser.new do |opts|
150
- opts.banner = "minitest options:"
161
+ opts.program_name = "minitest"
151
162
  opts.version = Minitest::VERSION
152
163
 
164
+ opts.banner = [
165
+ "Usage: rake test [A=options] (see Minitest::TestTask for more options)",
166
+ "minitest [paths] [options] (with minitest-sprint gem)",
167
+ "ruby path/to/test.rb [options]\n\n",
168
+ ].join "\n or: "
169
+
153
170
  opts.on "-h", "--help", "Display this help." do
154
171
  puts opts
155
172
  exit
156
173
  end
157
174
 
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"
175
+ desc = "Sets random seed. Also via env, eg: SEED=42"
161
176
  opts.on "-s", "--seed SEED", Integer, desc do |m|
162
- options[:seed] = m.to_i
177
+ options[:seed] = m
163
178
  end
164
179
 
165
- opts.on "-v", "--verbose", "Verbose. Show progress processing files." do
180
+ opts.on "-v", "--verbose", "Verbose. Print each name as they run." do
166
181
  options[:verbose] = true
167
182
  end
168
183
 
169
- opts.on "-q", "--quiet", "Quiet. Show no progress processing files." do
184
+ opts.on "-q", "--quiet", "Quiet. Show no dots while processing files." do
170
185
  options[:quiet] = true
171
186
  end
172
187
 
@@ -174,29 +189,38 @@ module Minitest
174
189
  options[:show_skips] = true
175
190
  end
176
191
 
177
- opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a|
178
- options[:filter] = a
192
+ opts.on "-b", "--bisect", "Run minitest in bisect-mode to isolate flaky tests."
193
+
194
+ opts.on "-i", "--include PATTERN", "Include /regexp/ or string for run." do |a|
195
+ options[:include] = a
179
196
  end
180
197
 
181
198
  opts.on "-e", "--exclude PATTERN", "Exclude /regexp/ or string from run." do |a|
182
199
  options[:exclude] = a
183
200
  end
184
201
 
202
+ # part of my unofficial embedded gem "makeoptparseworkwell"
203
+ def opts.topdict(name) = (name.length > 1 ? top.long : top.short)
204
+ def opts.alias(from, to) = (dict = topdict(from) ; dict[to] = dict[from])
205
+
206
+ # these will work but won't show up in --help output:
207
+ opts.alias "include", "name"
208
+ opts.alias "i", "n"
209
+ opts.alias "e", "x"
210
+
185
211
  opts.on "-S", "--skip CODES", String, "Skip reporting of certain types of results (eg E)." do |s|
186
212
  options[:skip] = s.chars.to_a
187
213
  end
188
214
 
189
- ruby27plus = ::Warning.respond_to? :[]=
190
-
191
215
  opts.on "-W[error]", String, "Turn Ruby warnings into errors" do |s|
192
216
  options[:Werror] = true
193
217
  case s
194
218
  when "error", "all", nil then
195
- require "minitest/error_on_warning"
219
+ require_relative "minitest/error_on_warning"
196
220
  $VERBOSE = true
197
- ::Warning[:deprecated] = true if ruby27plus
221
+ ::Warning[:deprecated] = true
198
222
  else
199
- ::Warning[s.to_sym] = true if ruby27plus # check validity of category
223
+ ::Warning[s.to_sym] = true # check validity of category
200
224
  end
201
225
  end
202
226
 
@@ -253,23 +277,20 @@ module Minitest
253
277
  #
254
278
  # The overall structure of a run looks like this:
255
279
  #
280
+ # [Minitest.load_plugins] optional, called by user, or require what you want
256
281
  # Minitest.autorun
257
282
  # Minitest.run(args)
258
- # Minitest.load_plugins
259
283
  # Minitest.process_args
260
284
  # Minitest.init_plugins
261
- # Minitest.__run(reporter, options)
285
+ # Minitest.run_all_suites(reporter, options)
262
286
  # Runnable.runnables.each |runnable_klass|
263
- # runnable_klass.run(reporter, options)
264
- # filtered_methods = runnable_methods.select {...}.reject {...}
287
+ # runnable_klass.run_suite(reporter, options)
288
+ # filtered_methods = runnable_klass.filter_runnable_methods options
265
289
  # filtered_methods.each |runnable_method|
266
- # runnable_klass.run_one_method(self, runnable_method, reporter)
267
- # Minitest.run_one_method(runnable_klass, runnable_method)
268
- # runnable_klass.new(runnable_method).run
290
+ # runnable_klass.run(self, runnable_method, reporter)
291
+ # runnable_klass.new(runnable_method).run
269
292
 
270
293
  def self.run args = []
271
- self.load_plugins unless args.delete("--no-plugins") || ENV["MT_NO_PLUGINS"]
272
-
273
294
  options = process_args args
274
295
 
275
296
  Minitest.seed = options[:seed]
@@ -286,7 +307,7 @@ module Minitest
286
307
  self.parallel_executor.start if parallel_executor.respond_to? :start
287
308
  reporter.start
288
309
  begin
289
- __run reporter, options
310
+ run_all_suites reporter, options
290
311
  finished = true
291
312
  rescue Interrupt
292
313
  warn "Interrupted. Exiting..."
@@ -303,7 +324,7 @@ module Minitest
303
324
  end
304
325
 
305
326
  def self.empty_run! options # :nodoc:
306
- filter = options[:filter]
327
+ filter = options[:include]
307
328
  return true unless filter # no filter, but nothing ran == success
308
329
 
309
330
  warn "Nothing ran for filter: %s" % [filter]
@@ -322,17 +343,17 @@ module Minitest
322
343
  # Internal run method. Responsible for telling all Runnable
323
344
  # sub-classes to run.
324
345
 
325
- def self.__run reporter, options
346
+ def self.run_all_suites reporter, options
326
347
  suites = Runnable.runnables.shuffle
327
- parallel, serial = suites.partition { |s| s.test_order == :parallel }
348
+ parallel, serial = suites.partition { |s| s.run_order == :parallel }
328
349
 
329
350
  # If we run the parallel tests before the serial tests, the parallel tests
330
351
  # could run in parallel with the serial tests. This would be bad because
331
352
  # the serial tests won't lock around Reporter#record. Run the serial tests
332
353
  # first, so that after they complete, the parallel tests will lock when
333
354
  # recording results.
334
- serial.map { |suite| suite.run reporter, options } +
335
- parallel.map { |suite| suite.run reporter, options }
355
+ serial.map { |suite| suite.run_suite reporter, options } +
356
+ parallel.map { |suite| suite.run_suite reporter, options }
336
357
  end
337
358
 
338
359
  def self.filter_backtrace bt # :nodoc:
@@ -400,20 +421,30 @@ module Minitest
400
421
  reset
401
422
 
402
423
  ##
403
- # Responsible for running all runnable methods in a given class,
404
- # each in its own instance. Each instance is passed to the
405
- # reporter to record.
424
+ # Returns an array of filtered +runnable_methods+. Uses
425
+ # options[:include] (--include arguments) and options[:exclude]
426
+ # (--exclude arguments) values to filter.
406
427
 
407
- def self.run reporter, options = {}
408
- pos = options[:filter]
428
+ def self.filter_runnable_methods options={}
429
+ pos = options[:include]
409
430
  neg = options[:exclude]
410
431
 
411
432
  pos = Regexp.new $1 if pos.kind_of?(String) && pos =~ %r%/(.*)/%
412
433
  neg = Regexp.new $1 if neg.kind_of?(String) && neg =~ %r%/(.*)/%
413
434
 
414
- filtered_methods = self.runnable_methods
435
+ # at most 1-2% slower than a 1-pass version, stop optimizing this
436
+ self.runnable_methods
415
437
  .select { |m| !pos || pos === m || pos === "#{self}##{m}" }
416
438
  .reject { |m| neg && (neg === m || neg === "#{self}##{m}") }
439
+ end
440
+
441
+ ##
442
+ # Responsible for running all runnable methods in a given class,
443
+ # each in its own instance. Each instance is passed to the
444
+ # reporter to record.
445
+
446
+ def Runnable.run_suite reporter, options = {}
447
+ filtered_methods = filter_runnable_methods options
417
448
 
418
449
  return if filtered_methods.empty?
419
450
 
@@ -428,12 +459,12 @@ module Minitest
428
459
  warn "Current: %s#%s %.2fs" % [self, name, Minitest.clock_time - t0]
429
460
  end
430
461
 
431
- with_info_handler reporter do
462
+ with_info_handler do
432
463
  filtered_methods.each do |method_name|
433
464
  name = method_name
434
465
  t0 = Minitest.clock_time
435
466
 
436
- run_one_method self, method_name, reporter
467
+ run self, method_name, reporter
437
468
  end
438
469
  end
439
470
  end
@@ -444,20 +475,20 @@ module Minitest
444
475
  # that subclasses can specialize the running of an individual
445
476
  # test. See Minitest::ParallelTest::ClassMethods for an example.
446
477
 
447
- def self.run_one_method klass, method_name, reporter
478
+ def Runnable.run klass, method_name, reporter
448
479
  reporter.prerecord klass, method_name
449
- reporter.record Minitest.run_one_method(klass, method_name)
480
+ reporter.record klass.new(method_name).run
450
481
  end
451
482
 
452
483
  ##
453
484
  # Defines the order to run tests (:random by default). Override
454
485
  # this or use a convenience method to change it for your tests.
455
486
 
456
- def self.test_order
487
+ def self.run_order
457
488
  :random
458
489
  end
459
490
 
460
- def self.with_info_handler reporter, &block # :nodoc:
491
+ def self.with_info_handler _reporter=nil, &block # :nodoc:
461
492
  on_signal ::Minitest.info_signal, @_info_handler, &block
462
493
  end
463
494
 
@@ -491,22 +522,6 @@ module Minitest
491
522
  @@runnables
492
523
  end
493
524
 
494
- @@marshal_dump_warned = false
495
-
496
- def marshal_dump # :nodoc:
497
- unless @@marshal_dump_warned then
498
- warn ["Minitest::Runnable#marshal_dump is deprecated.",
499
- "You might be violating internals. From", caller(1..1).first].join " "
500
- @@marshal_dump_warned = true
501
- end
502
-
503
- [self.name, self.failures, self.assertions, self.time]
504
- end
505
-
506
- def marshal_load ary # :nodoc:
507
- self.name, self.failures, self.assertions, self.time = ary
508
- end
509
-
510
525
  def failure # :nodoc:
511
526
  self.failures.first
512
527
  end
@@ -574,7 +589,7 @@ module Minitest
574
589
  def skipped?
575
590
  raise NotImplementedError, "subclass responsibility"
576
591
  end
577
- end
592
+ end # Runnable
578
593
 
579
594
  ##
580
595
  # Shared code for anything that can get passed to a Reporter. See
@@ -626,7 +641,7 @@ module Minitest
626
641
  def error?
627
642
  self.failures.any? UnexpectedError
628
643
  end
629
- end
644
+ end # Reportable
630
645
 
631
646
  ##
632
647
  # This represents a test result in a clean way that can be
@@ -638,9 +653,6 @@ module Minitest
638
653
  class Result < Runnable
639
654
  include Minitest::Reportable
640
655
 
641
- undef_method :marshal_dump
642
- undef_method :marshal_load
643
-
644
656
  ##
645
657
  # The class name of the test result.
646
658
 
@@ -680,7 +692,7 @@ module Minitest
680
692
  "#{failure.result_label}:\n#{self.location}:\n#{failure.message}\n"
681
693
  }.join "\n"
682
694
  end
683
- end
695
+ end # Result
684
696
 
685
697
  ##
686
698
  # Defines the API for Reporters. Subclass this and override whatever
@@ -730,7 +742,7 @@ module Minitest
730
742
  def synchronize &block # :nodoc:
731
743
  @mutex.synchronize(&block)
732
744
  end
733
- end
745
+ end # AbstractReportera
734
746
 
735
747
  class Reporter < AbstractReporter # :nodoc:
736
748
  ##
@@ -885,7 +897,7 @@ module Minitest
885
897
  self.warnings = aggregate[UnexpectedWarning].size
886
898
  self.skips = aggregate[Skip].size
887
899
  end
888
- end
900
+ end # StatisticsReporter
889
901
 
890
902
  ##
891
903
  # A reporter that prints the header, summary, and failure details at
@@ -963,7 +975,7 @@ module Minitest
963
975
  "%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
964
976
  [count, assertions, failures, errors, skips, extra.join]
965
977
  end
966
- end
978
+ end # SummaryReporter
967
979
 
968
980
  ##
969
981
  # Dispatch to multiple reporters as one.
@@ -1000,8 +1012,7 @@ module Minitest
1000
1012
 
1001
1013
  def prerecord klass, name # :nodoc:
1002
1014
  self.reporters.each do |reporter|
1003
- # TODO: remove conditional for minitest 6
1004
- reporter.prerecord klass, name if reporter.respond_to? :prerecord
1015
+ reporter.prerecord klass, name
1005
1016
  end
1006
1017
  end
1007
1018
 
@@ -1014,7 +1025,7 @@ module Minitest
1014
1025
  def report # :nodoc:
1015
1026
  self.reporters.each(&:report)
1016
1027
  end
1017
- end
1028
+ end # CompositeReporter
1018
1029
 
1019
1030
  ##
1020
1031
  # Represents run failures.
@@ -1127,16 +1138,6 @@ module Minitest
1127
1138
  "java" == platform
1128
1139
  end
1129
1140
 
1130
- ##
1131
- # Is this running on maglev?
1132
-
1133
- def maglev? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
1134
- where = Minitest.filter_backtrace(caller).first
1135
- where = where.split(":in ", 2).first # clean up noise
1136
- warn "DEPRECATED: `maglev?` called from #{where}. This will fail in Minitest 6."
1137
- "maglev" == platform
1138
- end
1139
-
1140
1141
  ##
1141
1142
  # Is this running on mri?
1142
1143
 
@@ -1151,16 +1152,6 @@ module Minitest
1151
1152
  platform.include? "darwin"
1152
1153
  end
1153
1154
 
1154
- ##
1155
- # Is this running on rubinius?
1156
-
1157
- def rubinius? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
1158
- where = Minitest.filter_backtrace(caller).first
1159
- where = where.split(":in ", 2).first # clean up noise
1160
- warn "DEPRECATED: `rubinius?` called from #{where}. This will fail in Minitest 6."
1161
- "rbx" == platform
1162
- end
1163
-
1164
1155
  ##
1165
1156
  # Is this running on windows?
1166
1157
 
@@ -1206,12 +1197,6 @@ module Minitest
1206
1197
 
1207
1198
  self.backtrace_filter = BacktraceFilter.new
1208
1199
 
1209
- def self.run_one_method klass, method_name # :nodoc:
1210
- result = klass.new(method_name).run
1211
- raise "#{klass}#run _must_ return a Result" unless Result === result
1212
- result
1213
- end
1214
-
1215
1200
  # :stopdoc:
1216
1201
 
1217
1202
  if defined? Process::CLOCK_MONOTONIC # :nodoc:
@@ -1234,4 +1219,4 @@ module Minitest
1234
1219
  # :startdoc:
1235
1220
  end
1236
1221
 
1237
- require "minitest/test"
1222
+ require_relative "minitest/test"
@@ -79,7 +79,7 @@ class MetaMetaMetaTestCase < Minitest::Test
79
79
  @tus.each do |tu|
80
80
  Minitest::Runnable.runnables.delete tu
81
81
 
82
- tu.run reporter, options
82
+ tu.run_suite reporter, options
83
83
  end
84
84
 
85
85
  reporter.report