minitest 5.25.5 → 5.26.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2ea23b9f86dd37b5f5f3d45fb451303827cbdf9414215d8f769da3624184325
4
- data.tar.gz: 3d976e8b864261af92ba50d466235e4fa529f31d3560d60ec4deba8e724fc872
3
+ metadata.gz: 0b434a6ca2a7c9344e640e80ea64a4b5b1849f8b6afa49c6f00766c2be0d4860
4
+ data.tar.gz: 84ae1cd082c17c1abca248bfbe841ca362c9bcb96e97c64eb524b6e46a50f94b
5
5
  SHA512:
6
- metadata.gz: 1258d24412b8461fe9a94acb9b795a1cd2a25db2d16f924ce6367662478d9e0672532636b5a2ccd809f549ba8ba6ab8f0cbeb6e8a249b1b91161cc4297f31c92
7
- data.tar.gz: 4d6a977e948f40d05e7786d07656616e9f3a4e4469a59e7b5a8e571b8f6821284989156ca4225e8e7a29cfe640bbaf544248697e14536f7c63946ffc2a34232e
6
+ metadata.gz: 592d2b5d8f7e33ea2c7ae8e598686df07108cd6bf3ae01bdc86871d16d17708db778716edfedb9bd6723972b7191615c9d29af7dba9b2231a70f0da394787c71
7
+ data.tar.gz: 407d3eb51b95f993a6809aa15ffbfa0630d31f0f18cf01854a2c68441fcda0555fdb2d2c83f41f7e605c8d4d4ade40e3785480f035e22492a54038e26900f0e7
checksums.yaml.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- j��F�<_{@EJ�9��t������
2
- xǥ���U˗��Y�,�K��
3
- �2�7,�rԽS
4
- �s�{�!�U����@@�S��{�uxՀ��h
1
+ (����;Y[ݻ�����"I[�shE�ݍ�L7����S��覕��b���9p��0B:w\�g�Qc�n�a�Z��H�3��<�i"��Dٴڙ%���e�nL���G/�[�G���Ṋ�|,�
2
+ (ٛ#�%)U#�&��`����aܔA�Ɉ_�>�%��_�%���e��}Z�;�p
data/History.rdoc CHANGED
@@ -1,3 +1,45 @@
1
+ === 5.26.2 / 2025-11-17
2
+
3
+ * 5 bug fixes:
4
+
5
+ * Bumped minimum ruby to 3.1.
6
+ * Alias Spec#name to #inspect for cleaner output in repls.
7
+ * Fix pathing for Hoe::Minitest initialization to be more generic.
8
+ * Fixed refute_in_epsilon to use min of abs values. (wtn)
9
+ * Improved options processing and usage output to be more clear.
10
+
11
+ === 5.26.1 / 2025-11-08
12
+
13
+ The Ocean Shores, Slightly Less Tipsy Edition!
14
+
15
+ * 3 bug fixes:
16
+
17
+ * Add links to API doco in README.
18
+ * Add missing require thread.
19
+ * Bumped ruby version to include 4.0 (trunk). (hsbt)
20
+ (see also 5.14.2)
21
+
22
+ === 5.26.0 / 2025-10-07
23
+
24
+ The Seattle.rb Nerd Party, Slightly Tipsy Edition!
25
+
26
+ * 2 minor enhancements:
27
+
28
+ * Added extra documentation to Minitest::TestTask options.
29
+ * Make parallelize_me! a no-op when n_threads=1.
30
+
31
+ * 9 bug fixes:
32
+
33
+ * Bypass parallel_executor entirely when n_threads=1.
34
+ * Don't require rubygems in Rakefile... it is 2025.
35
+ * Ensure that minitest exits non-zero on Interrupt. (tavianator)
36
+ * Fix Minitest.run sequence rdoc to include loop vars and read consistently.
37
+ * Fix call to parallel_executor.shutdown when it isn't defined.
38
+ * Removed some 1.8/1.9-based code from the assertions and expectations.
39
+ * Still fighting with rdoc? Yup. Still fighting with rdoc...
40
+ * Switched assert_equal's diff from Tempfile.open to Tempfile.create.
41
+ * Use Regexp.escape for BASE_RE in case pwd has special chars. (astra_1993)
42
+
1
43
  === 5.25.5 / 2025-03-12
2
44
 
3
45
  * 4 bug fixes:
data/README.rdoc CHANGED
@@ -95,7 +95,9 @@ Given that you'd like to test the following class:
95
95
 
96
96
  === Unit tests
97
97
 
98
- Define your tests as methods beginning with +test_+.
98
+ Define your tests as methods beginning with +test_+. Use
99
+ {assertions}[/minitest/Minitest/Assertions.html] to test for results
100
+ or state.
99
101
 
100
102
  require "minitest/autorun"
101
103
 
@@ -119,6 +121,9 @@ Define your tests as methods beginning with +test_+.
119
121
 
120
122
  === Specs
121
123
 
124
+ Use {expectations}[/minitest/Minitest/Expectations.html] to check
125
+ results or state. They must be wrapped in a value call (eg +_+).
126
+
122
127
  require "minitest/autorun"
123
128
 
124
129
  describe Meme do
@@ -146,7 +151,7 @@ For matchers support check out:
146
151
 
147
152
  === Benchmarks
148
153
 
149
- Add benchmarks to your tests.
154
+ Add {benchmarks}[/minitest/Minitest/Benchmark.html] to your tests.
150
155
 
151
156
  # optionally run benchmarks, good for CI-only work!
152
157
  require "minitest/benchmark" if ENV["BENCH"]
@@ -422,13 +427,10 @@ Current versions of rails: (https://endoflife.date/rails)
422
427
 
423
428
  | rails | min ruby | minitest | status | EOL Date |
424
429
  |-------+----------+----------+----------+------------|
430
+ | 8.1 | >= 3.2 | >= 5.1 | Current | 2027-10-07 |
425
431
  | 8.0 | >= 3.2 | >= 5.1 | Current | 2026-11-07 |
426
- | 7.2 | >= 3.1 | >= 5.1 | Current | 2026-08-09 |
427
- | 7.1 | >= 2.7 | >= 5.1 | Security | 2025-10-01 |
428
- | 7.0 | >= 2.7 | >= 5.1 | Security | 2025-04-01 |
429
- | 6.1 | >= 2.5 | >= 5.1 | EOL | 2024-10-01 |
430
- | 6.0 | >= 2.5 | >= 5.1 | EOL | 2023-06-01 |
431
- | 5.2 | >= 2.2.2 | ~> 5.1 | EOL | 2022-06-01 |
432
+ | 7.2 | >= 3.1 | >= 5.1 | Security | 2026-08-09 |
433
+ | 7.1 | >= 2.7 | >= 5.1 | EOL | 2025-10-01 |
432
434
 
433
435
  If you want to look at the requirements for a specific version, run:
434
436
 
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  # -*- ruby -*-
2
2
 
3
- require "rubygems"
4
3
  require "hoe"
5
4
  $:.unshift "lib" # to pick up lib/minitest/test_task.rb when minitest not installed
6
5
 
@@ -12,7 +11,7 @@ Hoe.spec "minitest" do
12
11
 
13
12
  license "MIT"
14
13
 
15
- require_ruby_version [">= 2.7", "< 4.0"]
14
+ require_ruby_version ">= 3.1"
16
15
  end
17
16
 
18
17
  desc "Find missing expectations"
data/design_rationale.rb CHANGED
@@ -2,25 +2,27 @@
2
2
  ###############################################################################
3
3
  describe Thingy do # class TestThingy < Minitest::Test
4
4
  before do # def setup
5
- do_some_setup # super
6
- end # do_some_setup
7
- # end
8
- it "should do the first thing" do #
9
- 1.must_equal 1 # def test_first_thing
10
- end # assert_equal 1, 1
11
- # end
12
- describe SubThingy do # end
13
- before do #
14
- do_more_setup # class TestSubThingy < TestThingy
15
- end # def setup
16
5
  # super
17
- it "should do the second thing" do # do_more_setup
18
- 2.must_equal 2 # end
19
- end #
20
- end # def test_second_thing
21
- end # assert_equal 2, 2
22
- # end
6
+ do_some_setup # do_some_setup
7
+ end # end
8
+ #
9
+ it "should do the first thing" do # def test_first_thing
10
+ _(1).must_equal 1 # assert_equal 1, 1
11
+ end # end
23
12
  # end
13
+ #
14
+ describe SubThingy do # class TestSubThingy < TestThingy
15
+ before do # def setup
16
+ # super
17
+ do_more_setup # do_more_setup
18
+ end # end
19
+ #
20
+ it "should do the second thing" do # def test_second_thing
21
+ _(2).must_equal 2 # assert_equal 2, 2
22
+ end # end
23
+ end # end
24
+ end #
25
+ #
24
26
  ###############################################################################
25
27
  # runs 2 specs # runs 3 tests
26
28
  ###############################################################################
@@ -33,7 +35,7 @@ class ThingySpec < Minitest::Spec
33
35
  end
34
36
 
35
37
  def test_should_do_the_first_thing
36
- assert_equal 1, 1
38
+ _(1).must_equal 1
37
39
  end
38
40
  end
39
41
 
@@ -47,6 +49,6 @@ class SubThingySpec < ThingySpec
47
49
  remove_method :test_should_do_the_first_thing
48
50
 
49
51
  def test_should_do_the_second_thing
50
- assert_equal 2, 2
52
+ _(2).must_equal 2
51
53
  end
52
54
  end
data/lib/hoe/minitest.rb CHANGED
@@ -11,7 +11,8 @@ module Hoe::Minitest
11
11
 
12
12
  def initialize_minitest
13
13
  unless minitest? then
14
- dir = "../../minitest/dev/lib"
14
+ dir = File.expand_path "../..", __FILE__
15
+
15
16
  Hoe.add_include_dirs dir if File.directory? dir
16
17
  end
17
18
 
@@ -62,11 +62,11 @@ module Minitest
62
62
  return "Expected: #{mu_pp exp}\n Actual: #{mu_pp act}" unless
63
63
  expect
64
64
 
65
- Tempfile.open "expect" do |a|
65
+ Tempfile.create "expect" do |a|
66
66
  a.puts expect
67
67
  a.flush
68
68
 
69
- Tempfile.open "butwas" do |b|
69
+ Tempfile.create "butwas" do |b|
70
70
  b.puts butwas
71
71
  b.flush
72
72
 
@@ -500,14 +500,9 @@ module Minitest
500
500
  value = catch sym do
501
501
  begin
502
502
  yield
503
- rescue ThreadError => e # wtf?!? 1.8 + threads == suck
504
- default += ", not :#{e.message[/uncaught throw \`(\w+?)\'/, 1]}"
505
- rescue ArgumentError => e # 1.9 exception
503
+ rescue ArgumentError => e # 1.9+ exception
506
504
  raise e unless e.message.include? "uncaught throw"
507
505
  default += ", not #{e.message.split(/ /).last}"
508
- rescue NameError => e # 1.8 exception
509
- raise e unless e.name == sym
510
- default += ", not #{e.name.inspect}"
511
506
  end
512
507
  caught = false
513
508
  end
@@ -692,8 +687,8 @@ module Minitest
692
687
  # For comparing Floats. Fails if +exp+ and +act+ have a relative error
693
688
  # less than +epsilon+.
694
689
 
695
- def refute_in_epsilon a, b, epsilon = 0.001, msg = nil
696
- refute_in_delta a, b, a * epsilon, msg
690
+ def refute_in_epsilon exp, act, epsilon = 0.001, msg = nil
691
+ refute_in_delta exp, act, [exp.abs, act.abs].min * epsilon, msg
697
692
  end
698
693
 
699
694
  ##
data/lib/minitest/mock.rb CHANGED
@@ -33,17 +33,9 @@ module Minitest # :nodoc:
33
33
  old_w, $-w = $-w, nil
34
34
  define_method method_id do |*args, **kwargs, &b|
35
35
  if @expected_calls.key? method_id then
36
- if kwargs.empty? then # FIX: drop this after 2.7 dead
37
- method_missing(method_id, *args, &b)
38
- else
39
- method_missing(method_id, *args, **kwargs, &b)
40
- end
36
+ method_missing(method_id, *args, **kwargs, &b)
41
37
  else
42
- if kwargs.empty? then # FIX: drop this after 2.7 dead
43
- super(*args, &b)
44
- else
45
- super(*args, **kwargs, &b)
46
- end
38
+ super(*args, **kwargs, &b)
47
39
  end
48
40
  end
49
41
  ensure
@@ -155,11 +147,7 @@ module Minitest # :nodoc:
155
147
  def method_missing sym, *args, **kwargs, &block # :nodoc:
156
148
  unless @expected_calls.key? sym then
157
149
  if @delegator && @delegator.respond_to?(sym)
158
- if kwargs.empty? then # FIX: drop this after 2.7 dead
159
- return @delegator.public_send(sym, *args, &block)
160
- else
161
- return @delegator.public_send(sym, *args, **kwargs, &block)
162
- end
150
+ return @delegator.public_send(sym, *args, **kwargs, &block)
163
151
  else
164
152
  raise NoMethodError, "unmocked method %p, expected one of %p" %
165
153
  [sym, @expected_calls.keys.sort_by(&:to_s)]
@@ -320,18 +308,10 @@ class Object
320
308
  else
321
309
  metaclass.send :define_method, name do |*args, **kwargs, &blk|
322
310
  if val_or_callable.respond_to? :call then
323
- if kwargs.empty? then # FIX: drop this after 2.7 dead
324
- val_or_callable.call(*args, &blk)
325
- else
326
- val_or_callable.call(*args, **kwargs, &blk)
327
- end
311
+ val_or_callable.call(*args, **kwargs, &blk)
328
312
  else
329
313
  if blk then
330
- if block_kwargs.empty? then # FIX: drop this after 2.7 dead
331
- blk.call(*block_args)
332
- else
333
- blk.call(*block_args, **block_kwargs)
334
- end
314
+ blk.call(*block_args, **block_kwargs)
335
315
  end
336
316
  val_or_callable
337
317
  end
@@ -1,3 +1,5 @@
1
+ require "thread"
2
+
1
3
  module Minitest
2
4
  module Parallel # :nodoc:
3
5
 
data/lib/minitest/spec.rb CHANGED
@@ -38,7 +38,11 @@ class Module # :nodoc:
38
38
  end
39
39
  end
40
40
 
41
- Minitest::Expectation = Struct.new :target, :ctx # :nodoc:
41
+ # :stopdoc:
42
+ module Minitest # fucking hell rdoc...
43
+ Expectation = Struct.new :target, :ctx
44
+ end
45
+ # :startdoc:
42
46
 
43
47
  ##
44
48
  # Kernel extensions for minitest
@@ -285,9 +289,8 @@ class Minitest::Spec < Minitest::Test
285
289
  defined?(@name) ? @name : super
286
290
  end
287
291
 
288
- def to_s # :nodoc:
289
- name # Can't alias due to 1.8.7, not sure why
290
- end
292
+ alias to_s name
293
+ alias inspect name
291
294
 
292
295
  attr_reader :desc # :nodoc:
293
296
  alias specify it
data/lib/minitest/test.rb CHANGED
@@ -58,6 +58,7 @@ module Minitest
58
58
  # tests are awesome.
59
59
 
60
60
  def self.parallelize_me!
61
+ return unless Minitest.parallel_executor
61
62
  include Minitest::Parallel::Test
62
63
  extend Minitest::Parallel::Test::ClassMethods
63
64
  end
@@ -44,8 +44,16 @@ module Minitest # :nodoc:
44
44
  WINDOWS = RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ # :nodoc:
45
45
 
46
46
  ##
47
- # Create several test-oriented tasks under +name+. Takes an
48
- # optional block to customize variables.
47
+ # Create several test-oriented tasks under +name+ (default:
48
+ # "test"). Takes an optional block to customize variables.
49
+ # Examples:
50
+ #
51
+ # Minitest::TestTask.create # named "test", all defaults
52
+ #
53
+ # Minitest::TestTask.create do |t|
54
+ # t.warning = false # my tests are noisy
55
+ # t.framework = %(require_relative "./test/helper.rb")
56
+ # end
49
57
 
50
58
  def self.create name = :test, &block
51
59
  task = new name
@@ -69,9 +77,18 @@ module Minitest # :nodoc:
69
77
 
70
78
  ##
71
79
  # The code to load the framework. Defaults to requiring
72
- # minitest/autorun...
80
+ # minitest/autorun.
81
+ #
82
+ # If you have a test helper file that requires minitest/autorun
83
+ # and anything else your project standardizes on, then you'll
84
+ # probably want to change this to:
73
85
  #
74
- # Why do I have this as an option?
86
+ # Minitest::TestTask.create do |t|
87
+ # t.framework = %(require_relative "./test/helper.rb")
88
+ # end
89
+ #
90
+ # or something similar. NOTE: if you do this, then helper must
91
+ # require "minitest/autorun" at the top to start the tests.
75
92
 
76
93
  attr_accessor :framework
77
94
 
@@ -100,6 +117,11 @@ module Minitest # :nodoc:
100
117
 
101
118
  ##
102
119
  # Optional: Additional ruby to run before the test framework is loaded.
120
+ # Example:
121
+ #
122
+ # Minitest::TestTask.create "test:cov" do |t|
123
+ # t.test_prelude = %(require "simplecov")
124
+ # end
103
125
 
104
126
  attr_accessor :test_prelude
105
127
 
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.25.5" # :nodoc:
13
+ VERSION = "5.26.2" # :nodoc:
14
14
 
15
15
  @@installed_at_exit ||= false
16
16
  @@after_run = []
@@ -36,7 +36,7 @@ module Minitest
36
36
  warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"] && ENV["N"].to_i > 0
37
37
  n_threads = (ENV["MT_CPU"] || ENV["N"] || Etc.nprocessors).to_i
38
38
 
39
- self.parallel_executor = Parallel::Executor.new n_threads
39
+ self.parallel_executor = Parallel::Executor.new n_threads if n_threads > 1
40
40
 
41
41
  ##
42
42
  # Filter object for backtraces.
@@ -147,26 +147,32 @@ module Minitest
147
147
  orig_args = args.dup
148
148
 
149
149
  OptionParser.new do |opts|
150
- opts.banner = "minitest options:"
150
+ opts.program_name = "minitest"
151
151
  opts.version = Minitest::VERSION
152
152
 
153
+ opts.banner = [
154
+ "Usage: rake test [A=options] (see Minitest::TestTask for more options)",
155
+ "minitest [paths] [options] (with minitest-sprint gem)",
156
+ "ruby path/to/test.rb [options]\n\n",
157
+ ].join "\n or: "
158
+
153
159
  opts.on "-h", "--help", "Display this help." do
154
160
  puts opts
155
161
  exit
156
162
  end
157
163
 
158
- opts.on "--no-plugins", "Bypass minitest plugin auto-loading (or set $MT_NO_PLUGINS)."
164
+ opts.on "--no-plugins", "Bypass minitest plugin auto-loading (or env: MT_NO_PLUGINS=1)."
159
165
 
160
- desc = "Sets random seed. Also via env. Eg: SEED=n rake"
166
+ desc = "Sets random seed. Also via env, eg: SEED=42"
161
167
  opts.on "-s", "--seed SEED", Integer, desc do |m|
162
- options[:seed] = m.to_i
168
+ options[:seed] = m
163
169
  end
164
170
 
165
- opts.on "-v", "--verbose", "Verbose. Show progress processing files." do
171
+ opts.on "-v", "--verbose", "Verbose. Print each name as they run." do
166
172
  options[:verbose] = true
167
173
  end
168
174
 
169
- opts.on "-q", "--quiet", "Quiet. Show no progress processing files." do
175
+ opts.on "-q", "--quiet", "Quiet. Show no dots while processing files." do
170
176
  options[:quiet] = true
171
177
  end
172
178
 
@@ -174,7 +180,7 @@ module Minitest
174
180
  options[:show_skips] = true
175
181
  end
176
182
 
177
- opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a|
183
+ opts.on "-n", "--name PATTERN", "Include /regexp/ or string for run." do |a|
178
184
  options[:filter] = a
179
185
  end
180
186
 
@@ -182,21 +188,28 @@ module Minitest
182
188
  options[:exclude] = a
183
189
  end
184
190
 
191
+ # omg wtf
192
+ def opts.short_alias(from, to) = top.short[to] = top.short[from]
193
+ def opts.long_alias(from, to) = top.long[to] = top.long[from]
194
+
195
+ # these will work but won't show up in --help output:
196
+ opts.long_alias "name", "include"
197
+ opts.short_alias "n", "i"
198
+ opts.short_alias "e", "x"
199
+
185
200
  opts.on "-S", "--skip CODES", String, "Skip reporting of certain types of results (eg E)." do |s|
186
201
  options[:skip] = s.chars.to_a
187
202
  end
188
203
 
189
- ruby27plus = ::Warning.respond_to? :[]=
190
-
191
204
  opts.on "-W[error]", String, "Turn Ruby warnings into errors" do |s|
192
205
  options[:Werror] = true
193
206
  case s
194
207
  when "error", "all", nil then
195
208
  require "minitest/error_on_warning"
196
209
  $VERBOSE = true
197
- ::Warning[:deprecated] = true if ruby27plus
210
+ ::Warning[:deprecated] = true
198
211
  else
199
- ::Warning[s.to_sym] = true if ruby27plus # check validity of category
212
+ ::Warning[s.to_sym] = true # check validity of category
200
213
  end
201
214
  end
202
215
 
@@ -259,12 +272,13 @@ module Minitest
259
272
  # Minitest.process_args
260
273
  # Minitest.init_plugins
261
274
  # Minitest.__run(reporter, options)
262
- # Runnable.runnables.each
275
+ # Runnable.runnables.each |runnable_klass|
263
276
  # runnable_klass.run(reporter, options)
264
- # self.runnable_methods.each
265
- # self.run_one_method(self, runnable_method, reporter)
266
- # Minitest.run_one_method(klass, runnable_method)
267
- # klass.new(runnable_method).run
277
+ # filtered_methods = runnable_methods.select {...}.reject {...}
278
+ # filtered_methods.each |runnable_method|
279
+ # runnable_klass.run_one_method(self, runnable_method, reporter)
280
+ # Minitest.run_one_method(runnable_klass, runnable_method)
281
+ # runnable_klass.new(runnable_method).run
268
282
 
269
283
  def self.run args = []
270
284
  self.load_plugins unless args.delete("--no-plugins") || ENV["MT_NO_PLUGINS"]
@@ -286,18 +300,19 @@ module Minitest
286
300
  reporter.start
287
301
  begin
288
302
  __run reporter, options
303
+ finished = true
289
304
  rescue Interrupt
290
305
  warn "Interrupted. Exiting..."
291
306
  end
292
- self.parallel_executor.shutdown
307
+ self.parallel_executor.shutdown if parallel_executor.respond_to? :shutdown
293
308
 
294
309
  # might have been removed/replaced during init_plugins:
295
310
  summary = reporter.reporters.grep(SummaryReporter).first
296
311
 
297
312
  reporter.report
298
313
 
299
- return empty_run! options if summary && summary.count == 0
300
- reporter.passed?
314
+ return empty_run! options if finished && summary && summary.count == 0
315
+ finished and reporter.passed?
301
316
  end
302
317
 
303
318
  def self.empty_run! options # :nodoc:
@@ -409,6 +424,7 @@ module Minitest
409
424
  pos = Regexp.new $1 if pos.kind_of?(String) && pos =~ %r%/(.*)/%
410
425
  neg = Regexp.new $1 if neg.kind_of?(String) && neg =~ %r%/(.*)/%
411
426
 
427
+ # at most 1-2% slower than a 1-pass version, stop optimizing this
412
428
  filtered_methods = self.runnable_methods
413
429
  .select { |m| !pos || pos === m || pos === "#{self}##{m}" }
414
430
  .reject { |m| neg && (neg === m || neg === "#{self}##{m}") }
@@ -572,7 +588,7 @@ module Minitest
572
588
  def skipped?
573
589
  raise NotImplementedError, "subclass responsibility"
574
590
  end
575
- end
591
+ end # Runnable
576
592
 
577
593
  ##
578
594
  # Shared code for anything that can get passed to a Reporter. See
@@ -624,7 +640,7 @@ module Minitest
624
640
  def error?
625
641
  self.failures.any? UnexpectedError
626
642
  end
627
- end
643
+ end # Reportable
628
644
 
629
645
  ##
630
646
  # This represents a test result in a clean way that can be
@@ -678,7 +694,7 @@ module Minitest
678
694
  "#{failure.result_label}:\n#{self.location}:\n#{failure.message}\n"
679
695
  }.join "\n"
680
696
  end
681
- end
697
+ end # Result
682
698
 
683
699
  ##
684
700
  # Defines the API for Reporters. Subclass this and override whatever
@@ -728,7 +744,7 @@ module Minitest
728
744
  def synchronize &block # :nodoc:
729
745
  @mutex.synchronize(&block)
730
746
  end
731
- end
747
+ end # AbstractReportera
732
748
 
733
749
  class Reporter < AbstractReporter # :nodoc:
734
750
  ##
@@ -883,7 +899,7 @@ module Minitest
883
899
  self.warnings = aggregate[UnexpectedWarning].size
884
900
  self.skips = aggregate[Skip].size
885
901
  end
886
- end
902
+ end # StatisticsReporter
887
903
 
888
904
  ##
889
905
  # A reporter that prints the header, summary, and failure details at
@@ -961,7 +977,7 @@ module Minitest
961
977
  "%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
962
978
  [count, assertions, failures, errors, skips, extra.join]
963
979
  end
964
- end
980
+ end # SummaryReporter
965
981
 
966
982
  ##
967
983
  # Dispatch to multiple reporters as one.
@@ -1012,7 +1028,7 @@ module Minitest
1012
1028
  def report # :nodoc:
1013
1029
  self.reporters.each(&:report)
1014
1030
  end
1015
- end
1031
+ end # CompositeReporter
1016
1032
 
1017
1033
  ##
1018
1034
  # Represents run failures.
@@ -1079,7 +1095,7 @@ module Minitest
1079
1095
  self.error.backtrace
1080
1096
  end
1081
1097
 
1082
- BASE_RE = %r%#{Dir.pwd}/% # :nodoc:
1098
+ BASE_RE = %r%#{Regexp.escape Dir.pwd}/% # :nodoc:
1083
1099
 
1084
1100
  def message # :nodoc:
1085
1101
  bt = Minitest.filter_backtrace(self.backtrace).join("\n ")
@@ -142,8 +142,7 @@ class TestMinitestAssertions < Minitest::Test
142
142
  exp[1] = Object.new
143
143
  act[1] = Object.new
144
144
  act_obj = act[1]
145
- # TODO: switch to endless when 2.7 is dropped
146
- act_obj.define_singleton_method(:inspect) { "#<Object:0xXXXXXX>" }
145
+ def act_obj.inspect = "#<Object:0xXXXXXX>"
147
146
  msg = <<~EOM.chomp % [act]
148
147
  No visible difference in the Hash#inspect output.
149
148
  You should look at the implementation of #== on Hash or its members.
@@ -318,13 +317,13 @@ class TestMinitestAssertions < Minitest::Test
318
317
  end
319
318
 
320
319
  def test_assert_equal_string_both_escaped_unescaped_newlines
321
- msg = <<~EOM
320
+ msg = <<~'EOM' # NOTE: single quotes on heredoc
322
321
  --- expected
323
322
  +++ actual
324
323
  @@ -1,2 +1 @@
325
- -"A\\n
324
+ -"A\n
326
325
  -B"
327
- +"A\\n\\\\nB"
326
+ +"A\n\\nB"
328
327
  EOM
329
328
 
330
329
  assert_triggered msg do
@@ -1280,12 +1279,16 @@ class TestMinitestAssertions < Minitest::Test
1280
1279
  end
1281
1280
 
1282
1281
  def test_refute_in_epsilon_triggered
1283
- assert_triggered "Expected |10000 - 9990| (10) to not be <= 10.0." do
1284
- @tc.refute_in_epsilon 10_000, 9990
1282
+ assert_triggered "Expected |10000 - 9991| (9) to not be <= 9.991." do
1283
+ @tc.refute_in_epsilon 10_000, 9991
1285
1284
  flunk
1286
1285
  end
1287
1286
  end
1288
1287
 
1288
+ def test_refute_in_epsilon_minimum
1289
+ @tc.refute_in_epsilon 10_000, 9990
1290
+ end
1291
+
1289
1292
  def test_refute_includes
1290
1293
  @assertion_count = 2
1291
1294
 
@@ -368,11 +368,7 @@ class TestMinitestMock < Minitest::Test
368
368
  end
369
369
 
370
370
  assert_silent do
371
- if RUBY_VERSION > "3" then
372
- mock.foo arg1, arg2, arg3
373
- else
374
- mock.foo arg1, arg2, **arg3 # oddity just for ruby 2.7
375
- end
371
+ mock.foo arg1, arg2, arg3
376
372
  end
377
373
 
378
374
  assert_mock mock
@@ -401,8 +397,8 @@ class TestMinitestMock < Minitest::Test
401
397
  mock.foo k1: arg1, k2: arg2
402
398
  end
403
399
 
404
- # basically testing ruby ... need ? for ruby < 2.7 :(
405
- assert_match(/missing keyword: :?k3/, e.message)
400
+ # basically testing ruby
401
+ assert_match(/missing keyword: :k3/, e.message)
406
402
  end
407
403
 
408
404
  def test_mock_block_is_passed_keyword_args__block_bad_extra
@@ -416,8 +412,7 @@ class TestMinitestMock < Minitest::Test
416
412
  mock.foo k1: arg1, k2: arg2, k3: arg3
417
413
  end
418
414
 
419
- # basically testing ruby ... need ? for ruby < 2.7 :(
420
- assert_match(/unknown keyword: :?k3/, e.message)
415
+ assert_match(/unknown keyword: :k3/, e.message)
421
416
  end
422
417
 
423
418
  def test_mock_block_is_passed_keyword_args__block_bad_value
@@ -108,7 +108,7 @@ describe Minitest::Spec do
108
108
  end
109
109
 
110
110
  it "needs to catch an expected exception" do
111
- @assertion_count = 2
111
+ @assertion_count -= 2
112
112
 
113
113
  expect { raise "blah" }.must_raise RuntimeError
114
114
  expect { raise Minitest::Assertion }.must_raise Minitest::Assertion
@@ -710,8 +710,6 @@ describe Minitest::Spec do
710
710
  end
711
711
 
712
712
  describe Minitest::Spec, :let do
713
- i_suck_and_my_tests_are_order_dependent!
714
-
715
713
  def _count
716
714
  $let_count ||= 0
717
715
  end
@@ -722,21 +720,21 @@ describe Minitest::Spec, :let do
722
720
  end
723
721
 
724
722
  it "is evaluated once per example" do
725
- _(_count).must_equal 0
723
+ exp = _count + 1
726
724
 
727
- _(count).must_equal 1
728
- _(count).must_equal 1
725
+ _(count).must_equal exp
726
+ _(count).must_equal exp
729
727
 
730
- _(_count).must_equal 1
728
+ _(_count).must_equal exp
731
729
  end
732
730
 
733
731
  it "is REALLY evaluated once per example" do
734
- _(_count).must_equal 1
732
+ exp = _count + 1
735
733
 
736
- _(count).must_equal 2
737
- _(count).must_equal 2
734
+ _(count).must_equal exp
735
+ _(count).must_equal exp
738
736
 
739
- _(_count).must_equal 2
737
+ _(_count).must_equal exp
740
738
  end
741
739
 
742
740
  it 'raises an error if the name begins with "test"' do
@@ -941,6 +939,16 @@ class TestMeta < MetaMetaMetaTestCase
941
939
  assert_equal "ExampleB::random_method::addl_context", spec_c.name
942
940
  end
943
941
 
942
+ def test_inspect
943
+ spec_a = describe ExampleA do; end
944
+ spec_b = describe ExampleB, :random_method do; end
945
+ spec_c = describe ExampleB, :random_method, :addl_context do; end
946
+
947
+ assert_equal "ExampleA", spec_a.inspect
948
+ assert_equal "ExampleB::random_method", spec_b.inspect
949
+ assert_equal "ExampleB::random_method::addl_context", spec_c.inspect
950
+ end
951
+
944
952
  def test_name2
945
953
  assert_equal "NamedExampleA", NamedExampleA.name
946
954
  assert_equal "NamedExampleB", NamedExampleB.name
@@ -662,7 +662,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
662
662
  2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
663
663
  EOM
664
664
 
665
- skip if Minitest.parallel_executor.size < 2 # locks up test runner if 1 CPU
665
+ skip unless Minitest.parallel_executor # locks up test runner if 1 CPU
666
666
 
667
667
  assert_report expected do |reporter|
668
668
  reporter.extend Module.new {
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.25.5
4
+ version: 5.26.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -28,7 +28,7 @@ cert_chain:
28
28
  bwfinv7Yp5fA6AysuZLhCykyfDuZVRrUp0Vb68YCKsLjJly/Theak+euNTxvHsB+
29
29
  al9oSgPPHICMEX65qvLywitx
30
30
  -----END CERTIFICATE-----
31
- date: 2025-03-12 00:00:00.000000000 Z
31
+ date: 1980-01-02 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rdoc
@@ -56,14 +56,14 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '4.2'
59
+ version: '4.3'
60
60
  type: :development
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '4.2'
66
+ version: '4.3'
67
67
  description: |-
68
68
  minitest provides a complete suite of testing facilities supporting
69
69
  TDD, BDD, mocking, and benchmarking.
@@ -175,17 +175,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - ">="
177
177
  - !ruby/object:Gem::Version
178
- version: '2.7'
179
- - - "<"
180
- - !ruby/object:Gem::Version
181
- version: '4.0'
178
+ version: '3.1'
182
179
  required_rubygems_version: !ruby/object:Gem::Requirement
183
180
  requirements:
184
181
  - - ">="
185
182
  - !ruby/object:Gem::Version
186
183
  version: '0'
187
184
  requirements: []
188
- rubygems_version: 3.6.3
185
+ rubygems_version: 3.7.2
189
186
  specification_version: 4
190
187
  summary: minitest provides a complete suite of testing facilities supporting TDD,
191
188
  BDD, mocking, and benchmarking
metadata.gz.sig CHANGED
Binary file