minitest 5.22.3 → 5.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 549d1470d48f7424db415007d45cfd317ad88104e1e5004e97c46afa4d760a1a
4
- data.tar.gz: f6f2e952c63cb9074d2fccf45148ab5c5045aec5bdbeadfadcbbf8338107ec2d
3
+ metadata.gz: 504b1223be3a95fcfafe10a397384628113ff8514e0674ade01f3db968e7c1ae
4
+ data.tar.gz: 59e22fefd004b545f6084c5c91561502325add44200cc77203dbec3334746cd0
5
5
  SHA512:
6
- metadata.gz: da1e40c0087e97affdab34c247b98d5d4482ba47d3a0b677dcef4ebf0839827e304fba101a02fcebd38008a8d9ba9eaa163e98545d13927b276dcb461dac7237
7
- data.tar.gz: c4074d137040f0362af40a5cd9c637492ba983a0a8ab5341c2acb8d531725b10192c40b6002570695aca6da1c0c1bdb389a6eac94cefcda8a6b60d48b49c960d
6
+ metadata.gz: 5f387dcac2c6072f79ff1cb43f407bbb65f2f950785f27ec1b4a803f4ddc0200e5dd05bce956fe8d98ec10a7723c451b5e92b44b1356126657adf429ed616f59
7
+ data.tar.gz: 115fa22f9991580fa4b4e98eb31c10d2b775b5de731a66e6d61f50ec14c51ac87ee25c5c038e75e5889b4845fa546bd5c5d73b8ddf1abc88322dcf5cedbce328
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,15 @@
1
+ === 5.22.3 / 2024-03-13
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * MASSIVE improvement of minitest's pride plugin output: Frequencies doubled! Sine waves shifted!! Comments improved!!! Colors rotated!!!! (havenwood)
6
+
7
+ * 3 bug fixes:
8
+
9
+ * Improved wording on Minitest::Test#parallelize_me! to clarify it goes INSIDE your test class/describe.
10
+ * Minor changes to tests to pass when tests ran with extra flags (eg -p).
11
+ * Support Ruby 3.4's new error message format. (mame)
12
+
1
13
  === 5.22.2 / 2024-02-07
2
14
 
3
15
  * 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 fairly recently had an
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 2023-03-05)
415
+ (As of 2024-05-10)
416
416
 
417
417
  Current versions of rails: (https://endoflife.date/rails)
418
418
 
419
- | rails | min ruby | rec ruby | minitest | status | EOL Date |
420
- |-------+----------+----------+----------+----------+------------|
421
- | 7.0 | >= 2.7 | 3.1 | >= 5.1 | Current | 2025-06-01?|
422
- | 6.1 | >= 2.5 | 3.0 | >= 5.1 | Maint | 2024-06-01?|
423
- | 6.0 | >= 2.5 | 2.6 | >= 5.1 | Security | 2023-06-01 |
424
- | 5.2 | >= 2.2.2 | 2.5 | ~> 5.1 | EOL | 2022-06-01 |
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.2 | Current | 2026-03-31 |
435
- | 3.1 | Maint | 2025-03-31 |
436
- | 3.0 | Maint | 2024-03-31 |
437
- | 2.7 | Security| 2023-03-31 |
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
@@ -0,0 +1,11 @@
1
+ module Minitest
2
+
3
+ module ErrorOnWarning
4
+ def warn(message, category: nil)
5
+ message = "[#{category}] #{message}" if category
6
+ raise UnexpectedWarning, message
7
+ end
8
+ end
9
+
10
+ ::Warning.singleton_class.prepend(ErrorOnWarning)
11
+ end
@@ -0,0 +1,16 @@
1
+ require "minitest"
2
+
3
+ ARGV << "--no-plugins"
4
+
5
+ module Minitest
6
+ ##
7
+ # Manually load plugins by name.
8
+
9
+ def self.load *names
10
+ names.each do |name|
11
+ require "minitest/#{name}_plugin"
12
+
13
+ self.extensions << name.to_s
14
+ end
15
+ end
16
+ end
@@ -114,7 +114,7 @@ module Minitest # :nodoc:
114
114
  self.test_globs = ["test/**/test_*.rb",
115
115
  "test/**/*_test.rb"]
116
116
  self.test_prelude = nil
117
- self.verbose = Rake.application.options.trace
117
+ self.verbose = Rake.application.options.trace || Rake.verbose == true
118
118
  self.warning = true
119
119
  end
120
120
 
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.22.2" # :nodoc:
12
+ VERSION = "5.22.3" # :nodoc:
13
13
 
14
14
  @@installed_at_exit ||= false
15
15
  @@after_run = []
@@ -167,10 +167,10 @@ module Minitest
167
167
 
168
168
  # might have been removed/replaced during init_plugins:
169
169
  summary = reporter.reporters.grep(SummaryReporter).first
170
- return empty_run! options if summary && summary.count == 0
171
170
 
172
171
  reporter.report
173
172
 
173
+ return empty_run! options if summary && summary.count == 0
174
174
  reporter.passed?
175
175
  end
176
176
 
@@ -253,6 +253,20 @@ module Minitest
253
253
  options[:skip] = s.chars.to_a
254
254
  end
255
255
 
256
+ ruby27plus = ::Warning.respond_to?(:[]=)
257
+
258
+ opts.on "-W[error]", String, "Turn Ruby warnings into errors" do |s|
259
+ options[:Werror] = true
260
+ case s
261
+ when "error", "all", nil then
262
+ require "minitest/error_on_warning"
263
+ $VERBOSE = true
264
+ ::Warning[:deprecated] = true if ruby27plus
265
+ else
266
+ ::Warning[s.to_sym] = true if ruby27plus # check validity of category
267
+ end
268
+ end
269
+
256
270
  unless extensions.empty?
257
271
  opts.separator ""
258
272
  opts.separator "Known extensions: #{extensions.join(", ")}"
@@ -782,6 +796,11 @@ module Minitest
782
796
 
783
797
  attr_accessor :errors
784
798
 
799
+ ##
800
+ # Total number of tests that warned.
801
+
802
+ attr_accessor :warnings
803
+
785
804
  ##
786
805
  # Total number of tests that where skipped.
787
806
 
@@ -797,6 +816,7 @@ module Minitest
797
816
  self.total_time = nil
798
817
  self.failures = nil
799
818
  self.errors = nil
819
+ self.warnings = nil
800
820
  self.skips = nil
801
821
  end
802
822
 
@@ -825,6 +845,7 @@ module Minitest
825
845
  self.total_time = Minitest.clock_time - start_time
826
846
  self.failures = aggregate[Assertion].size
827
847
  self.errors = aggregate[UnexpectedError].size
848
+ self.warnings = aggregate[UnexpectedWarning].size
828
849
  self.skips = aggregate[Skip].size
829
850
  end
830
851
  end
@@ -900,6 +921,8 @@ module Minitest
900
921
  results.any?(&:skipped?) unless
901
922
  options[:verbose] or options[:show_skips] or ENV["MT_NO_SKIP_MSG"]
902
923
 
924
+ extra.prepend ", %d warnings" % [warnings] if options[:Werror]
925
+
903
926
  "%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
904
927
  [count, assertions, failures, errors, skips, extra]
905
928
  end
@@ -1034,6 +1057,15 @@ module Minitest
1034
1057
  end
1035
1058
  end
1036
1059
 
1060
+ ##
1061
+ # Assertion raised on warning when running in -Werror mode.
1062
+
1063
+ class UnexpectedWarning < Assertion
1064
+ def result_label # :nodoc:
1065
+ "Warning"
1066
+ end
1067
+ end
1068
+
1037
1069
  ##
1038
1070
  # Provides a simple set of guards that you can use in your tests
1039
1071
  # to skip execution if it is not applicable. These methods are
@@ -1107,7 +1139,7 @@ module Minitest
1107
1139
 
1108
1140
  class BacktraceFilter
1109
1141
 
1110
- MT_RE = %r%lib/minitest% #:nodoc:
1142
+ MT_RE = %r%lib/minitest|internal:warning% #:nodoc:
1111
1143
 
1112
1144
  attr_accessor :regexp
1113
1145
 
@@ -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('UTF-8'))
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
- assert_output "", err_re do
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 "ASCII"
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
@@ -975,16 +966,24 @@ class TestMinitestAssertions < Minitest::Test
975
966
  end
976
967
 
977
968
  def test_assert_send
978
- assert_deprecated :assert_send do
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
- assert_deprecated :assert_send do
985
- assert_triggered "Expected 1.>(*[2]) to return true." do
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
- assert_output "", /Stale skip_until \"not yet\" at .*?:\d+$/ do
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
- assert_output nil, /Using MT_KWARGS_HAC. yet passing kwargs/ do
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 "", "w"
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 "", "w"
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 "", "w"
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 "", "w"
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 "", "w"
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 "", "w"
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 "", "w"
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 "", "w"
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|
@@ -31,7 +31,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
31
31
 
32
32
  def setup
33
33
  super
34
- self.io = StringIO.new("")
34
+ self.io = StringIO.new(+"")
35
35
  self.r = new_composite_reporter
36
36
  end
37
37
 
@@ -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 += 1 # extra test
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
- out, err = capture_io do
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
- assert_raises RuntimeError do
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 += 1
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
- assert_equal "Calling #must_equal outside of test.", e.message
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 += 3
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
- assert_output "", exp do
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 += 3
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
- assert_output "", exp do
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('ASCII-8BIT')
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
- assert_output "", /DEPRECATED/ do
1129
+ assert_deprecation do
1130
1130
  assert self.class.rubinius? "rbx"
1131
1131
  end
1132
- assert_output "", /DEPRECATED/ do
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
- assert_output "", /DEPRECATED/ do
1138
+ assert_deprecation do
1139
1139
  assert self.class.maglev? "maglev"
1140
1140
  end
1141
- assert_output "", /DEPRECATED/ do
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.22.3
4
+ version: 5.23.0
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-03-13 00:00:00.000000000 Z
32
+ date: 2024-05-15 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
metadata.gz.sig CHANGED
Binary file