minitest 5.26.2 → 5.27.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b434a6ca2a7c9344e640e80ea64a4b5b1849f8b6afa49c6f00766c2be0d4860
4
- data.tar.gz: 84ae1cd082c17c1abca248bfbe841ca362c9bcb96e97c64eb524b6e46a50f94b
3
+ metadata.gz: f9144898bc998f49d23688386cb435165b7ba6fadf83acc47f8120992d2799c6
4
+ data.tar.gz: f90178ecc10c76e8d0cea4c2206972b3bbb899f552c53f1b22743e00d9898a02
5
5
  SHA512:
6
- metadata.gz: 592d2b5d8f7e33ea2c7ae8e598686df07108cd6bf3ae01bdc86871d16d17708db778716edfedb9bd6723972b7191615c9d29af7dba9b2231a70f0da394787c71
7
- data.tar.gz: 407d3eb51b95f993a6809aa15ffbfa0630d31f0f18cf01854a2c68441fcda0555fdb2d2c83f41f7e605c8d4d4ade40e3785480f035e22492a54038e26900f0e7
6
+ metadata.gz: a157620a20602d17c8aaf088cc9c709401d7fd3507569fceb85d358c5519596fdb2bd71ef8b1b597942ba9ba5ef9b0af1530fb97a47fac28add36600516d2edc
7
+ data.tar.gz: 17c0fdb228c63bda818fbc4009c30c88138df74e325e087050843bef8128ea54afade9de4c0e5af6d5f734ad114d34dd97e4eed2ac4e577662144ad8c49f261e
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1,4 @@
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
1
+
2
+ ��ި�f5e4|���8 %8V�:��]X�o���q
3
+ ��uץ6 ��#�()��u��N������<�ƅ�v
4
+ �������75��NY���x�z@�~�9�� {��e�\���E�N��jp�4�2ovX�l1��f�k�����Ru��qv O�d��%���������87y�5�4r����
data/README.rdoc CHANGED
@@ -1,11 +1,12 @@
1
1
  = minitest/{test,spec,mock,benchmark}
2
2
 
3
- home :: https://github.com/minitest/minitest
3
+ home :: https://minite.st/
4
+ code :: https://github.com/minitest/minitest
4
5
  bugs :: https://github.com/minitest/minitest/issues
5
6
  rdoc :: https://docs.seattlerb.org/minitest
6
7
  clog :: https://github.com/minitest/minitest/blob/master/History.rdoc
7
- vim :: https://github.com/sunaku/vim-ruby-minitest
8
8
  emacs:: https://github.com/arthurnn/minitest-emacs
9
+ vim :: https://github.com/vim-test/vim-test
9
10
 
10
11
  == DESCRIPTION:
11
12
 
data/Rakefile CHANGED
@@ -12,6 +12,23 @@ Hoe.spec "minitest" do
12
12
  license "MIT"
13
13
 
14
14
  require_ruby_version ">= 3.1"
15
+
16
+ self.post_install_message = <<~EOM
17
+ NOTE: minitest 5 will be the last in the minitest family to support
18
+ ruby 1.8 to 2.7. If you need to keep using these versions,
19
+ you need to pin your dependency to minitest with something
20
+ like "~> 5.0". See History.rdoc to locate compatible
21
+ versions.
22
+
23
+ Further, minitest 6 will be dropping the following:
24
+
25
+ + MiniTest (it's been Minitest for >10 years)
26
+ + MiniTest::Unit
27
+ + MiniTest::Unit::TestCase
28
+ + assert_send (unless you argue for it well)
29
+ + assert_equal nil, obj
30
+ + mocks and stubs: moving minitest/mock.rb to its own gem
31
+ EOM
15
32
  end
16
33
 
17
34
  desc "Find missing expectations"
@@ -196,6 +196,12 @@ module Minitest
196
196
  .split(":in ", 2).first # clean up noise
197
197
  end
198
198
 
199
+ def _caller_uplevel # :nodoc:
200
+ backtrace = caller
201
+ real_caller = Minitest.filter_backtrace(caller).first
202
+ backtrace.index(real_caller)
203
+ end
204
+
199
205
  E = "" # :nodoc:
200
206
 
201
207
  ##
@@ -219,7 +225,7 @@ module Minitest
219
225
  if Minitest::VERSION >= "6" then
220
226
  refute_nil exp, "Use assert_nil if expecting nil."
221
227
  else
222
- warn "DEPRECATED: Use assert_nil if expecting nil from #{_where}. This will fail in Minitest 6."
228
+ warn "DEPRECATED: Use assert_nil if expecting nil. This will fail in Minitest 6.", uplevel: _caller_uplevel
223
229
  end
224
230
  end
225
231
 
@@ -368,15 +374,12 @@ module Minitest
368
374
  # error.
369
375
 
370
376
  def assert_pattern
371
- raise NotImplementedError, "only available in Ruby 3.0+" unless RUBY_VERSION >= "3.0"
372
377
  flunk "assert_pattern requires a block to capture errors." unless block_given?
373
378
 
374
- begin # TODO: remove after ruby 2.6 dropped
375
- yield
376
- pass
377
- rescue NoMatchingPatternError => e
378
- flunk e.message
379
- end
379
+ yield
380
+ pass
381
+ rescue NoMatchingPatternError => e
382
+ flunk e.message
380
383
  end
381
384
 
382
385
  ##
@@ -471,7 +474,7 @@ module Minitest
471
474
  # Fails unless the call returns a true value
472
475
 
473
476
  def assert_send send_ary, m = nil
474
- warn "DEPRECATED: assert_send. From #{_where}"
477
+ warn "DEPRECATED: assert_send.", uplevel: _caller_uplevel
475
478
 
476
479
  recv, msg, *args = send_ary
477
480
  m = message(m) {
@@ -751,15 +754,12 @@ module Minitest
751
754
  # other exceptions will be raised as normal and generate a test error.
752
755
 
753
756
  def refute_pattern
754
- raise NotImplementedError, "only available in Ruby 3.0+" unless RUBY_VERSION >= "3.0"
755
757
  flunk "refute_pattern requires a block to capture errors." unless block_given?
756
758
 
757
- begin
758
- yield
759
- flunk "NoMatchingPatternError expected, but nothing was raised."
760
- rescue NoMatchingPatternError
761
- pass
762
- end
759
+ yield
760
+ flunk "NoMatchingPatternError expected, but nothing was raised."
761
+ rescue NoMatchingPatternError
762
+ pass
763
763
  end
764
764
 
765
765
  ##
@@ -1,6 +1,6 @@
1
- require "minitest"
2
- require "minitest/spec"
3
- require "minitest/mock"
4
- require "minitest/hell" if ENV["MT_HELL"]
1
+ require_relative "../minitest"
2
+ require_relative "spec"
3
+ require_relative "mock"
4
+ require_relative "hell" if ENV["MT_HELL"]
5
5
 
6
6
  Minitest.autorun
@@ -1,5 +1,5 @@
1
- require "minitest/test"
2
- require "minitest/spec"
1
+ require_relative "test"
2
+ require_relative "spec"
3
3
 
4
4
  module Minitest
5
5
  ##
data/lib/minitest/hell.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "minitest/parallel"
1
+ require_relative "parallel"
2
2
 
3
3
  class Minitest::Test
4
4
  parallelize_me!
@@ -1,4 +1,4 @@
1
- require "minitest"
1
+ require_relative "../minitest"
2
2
 
3
3
  ARGV << "--no-plugins"
4
4
 
@@ -1,4 +1,4 @@
1
- require "minitest"
1
+ require_relative "../minitest"
2
2
 
3
3
  Minitest.load_plugins
4
4
  Minitest::PrideIO.pride!
@@ -1,4 +1,4 @@
1
- require "minitest"
1
+ require_relative "../minitest"
2
2
 
3
3
  module Minitest
4
4
  def self.plugin_pride_options opts, _options # :nodoc:
data/lib/minitest/spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "minitest/test"
1
+ require_relative "test"
2
2
 
3
3
  class Module # :nodoc:
4
4
  def infect_an_assertion meth, new_name, dont_flip = false # :nodoc:
@@ -346,7 +346,7 @@ class Minitest::Spec < Minitest::Test
346
346
  TYPES = DSL::TYPES # :nodoc:
347
347
  end
348
348
 
349
- require "minitest/expectations"
349
+ require_relative "expectations"
350
350
 
351
351
  class Object # :nodoc:
352
352
  include Minitest::Expectations unless ENV["MT_NO_EXPECTATIONS"]
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,7 +8,7 @@ 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
 
@@ -235,4 +235,4 @@ module Minitest
235
235
  end # Test
236
236
  end
237
237
 
238
- require "minitest/unit" if ENV["MT_COMPAT"] # compatibility layer only
238
+ require_relative "unit" if ENV["MT_COMPAT"] # compatibility layer only
@@ -303,13 +303,8 @@ module Minitest # :nodoc:
303
303
  end
304
304
 
305
305
  class Work < Queue # :nodoc:
306
- def initialize jobs = [] # :nodoc:
307
- super()
308
-
309
- jobs.each do |job|
310
- self << job
311
- end
312
-
306
+ def initialize jobs # :nodoc:
307
+ super
313
308
  close
314
309
  end
315
310
  end
data/lib/minitest/unit.rb CHANGED
@@ -11,7 +11,7 @@ unless defined?(Minitest) then
11
11
  module Minitest # :nodoc:
12
12
  end
13
13
  MiniTest = Minitest # :nodoc: # prevents minitest.rb from requiring back to us
14
- require "minitest"
14
+ require_relative "../minitest"
15
15
  end
16
16
 
17
17
  MiniTest = Minitest unless defined?(MiniTest)
data/lib/minitest.rb CHANGED
@@ -68,8 +68,7 @@ module Minitest
68
68
  # Registers Minitest to run at process exit
69
69
 
70
70
  def self.autorun
71
- Warning[:deprecated] = true if
72
- Object.const_defined?(:Warning) && Warning.respond_to?(:[]=)
71
+ Warning[:deprecated] = true
73
72
 
74
73
  at_exit {
75
74
  next if $! and not ($!.kind_of? SystemExit and $!.success?)
@@ -188,14 +187,14 @@ module Minitest
188
187
  options[:exclude] = a
189
188
  end
190
189
 
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]
190
+ # part of my unofficial embedded gem "makeoptparseworkwell"
191
+ def opts.topdict(name) = (name.length > 1 ? top.long : top.short)
192
+ def opts.alias(from, to) = (dict = topdict(from) ; dict[to] = dict[from])
194
193
 
195
194
  # 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"
195
+ opts.alias "name", "include"
196
+ opts.alias "n", "i"
197
+ opts.alias "e", "x"
199
198
 
200
199
  opts.on "-S", "--skip CODES", String, "Skip reporting of certain types of results (eg E)." do |s|
201
200
  options[:skip] = s.chars.to_a
@@ -205,7 +204,7 @@ module Minitest
205
204
  options[:Werror] = true
206
205
  case s
207
206
  when "error", "all", nil then
208
- require "minitest/error_on_warning"
207
+ require_relative "minitest/error_on_warning"
209
208
  $VERBOSE = true
210
209
  ::Warning[:deprecated] = true
211
210
  else
@@ -1248,4 +1247,4 @@ module Minitest
1248
1247
  # :startdoc:
1249
1248
  end
1250
1249
 
1251
- require "minitest/test"
1250
+ require_relative "minitest/test"
@@ -291,7 +291,7 @@ class TestMinitestAssertions < Minitest::Test
291
291
  @tc.assert_equal nil, nil
292
292
  end
293
293
  else
294
- err_re = /Use assert_nil if expecting nil from .*test_minitest_\w+.rb/
294
+ err_re = /.*?test_minitest_\w+.rb:\d+: warning: DEPRECATED: Use assert_nil if expecting nil. This will fail in Minitest 6./
295
295
  err_re = "" if $-w.nil?
296
296
 
297
297
  assert_deprecation err_re do
@@ -1073,48 +1073,24 @@ class TestMinitestAssertions < Minitest::Test
1073
1073
  end
1074
1074
 
1075
1075
  def test_assert_pattern
1076
- if RUBY_VERSION > "3" then
1077
- @tc.assert_pattern do
1078
- exp = if RUBY_VERSION.start_with? "3.0"
1079
- "(eval):1: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!\n"
1080
- else
1081
- ""
1082
- end
1083
- assert_output nil, exp do
1084
- eval "[1,2,3] => [Integer, Integer, Integer]" # eval to escape parser for ruby<3
1085
- end
1086
- end
1087
- else
1088
- @assertion_count = 0
1089
-
1090
- assert_raises NotImplementedError do
1091
- @tc.assert_pattern do
1092
- # do nothing
1093
- end
1076
+ @tc.assert_pattern do
1077
+ assert_output nil, "" do
1078
+ [1,2,3] => [Integer, Integer, Integer]
1094
1079
  end
1095
1080
  end
1096
1081
  end
1097
1082
 
1098
1083
  def test_assert_pattern_traps_nomatchingpatternerror
1099
- skip unless RUBY_VERSION > "3"
1100
- exp = if RUBY_VERSION.start_with? "3.0" then
1101
- "[1, 2, 3]" # terrible error message!
1102
- else
1103
- /length mismatch/
1104
- end
1084
+ exp = /length mismatch/
1105
1085
 
1106
1086
  assert_triggered exp do
1107
1087
  @tc.assert_pattern do
1108
- capture_io do # 3.0 is noisy
1109
- eval "[1,2,3] => [Integer, Integer]" # eval to escape parser for ruby<3
1110
- end
1088
+ [1,2,3] => [Integer, Integer]
1111
1089
  end
1112
1090
  end
1113
1091
  end
1114
1092
 
1115
1093
  def test_assert_pattern_raises_other_exceptions
1116
- skip unless RUBY_VERSION >= "3.0"
1117
-
1118
1094
  @assertion_count = 0
1119
1095
 
1120
1096
  assert_raises RuntimeError do
@@ -1125,8 +1101,6 @@ class TestMinitestAssertions < Minitest::Test
1125
1101
  end
1126
1102
 
1127
1103
  def test_assert_pattern_with_no_block
1128
- skip unless RUBY_VERSION >= "3.0"
1129
-
1130
1104
  assert_triggered "assert_pattern requires a block to capture errors." do
1131
1105
  @tc.assert_pattern
1132
1106
  end
@@ -1385,38 +1359,20 @@ class TestMinitestAssertions < Minitest::Test
1385
1359
  end
1386
1360
 
1387
1361
  def test_refute_pattern
1388
- if RUBY_VERSION >= "3.0"
1389
- @tc.refute_pattern do
1390
- capture_io do # 3.0 is noisy
1391
- eval "[1,2,3] => [Integer, Integer, String]"
1392
- end
1393
- end
1394
- else
1395
- @assertion_count = 0
1396
-
1397
- assert_raises NotImplementedError do
1398
- @tc.refute_pattern do
1399
- eval "[1,2,3] => [Integer, Integer, String]"
1400
- end
1401
- end
1362
+ @tc.refute_pattern do
1363
+ [1,2,3] => [Integer, Integer, String]
1402
1364
  end
1403
1365
  end
1404
1366
 
1405
1367
  def test_refute_pattern_expects_nomatchingpatternerror
1406
- skip unless RUBY_VERSION > "3"
1407
-
1408
1368
  assert_triggered(/NoMatchingPatternError expected, but nothing was raised./) do
1409
1369
  @tc.refute_pattern do
1410
- capture_io do # 3.0 is noisy
1411
- eval "[1,2,3] => [Integer, Integer, Integer]"
1412
- end
1370
+ [1,2,3] => [Integer, Integer, Integer]
1413
1371
  end
1414
1372
  end
1415
1373
  end
1416
1374
 
1417
1375
  def test_refute_pattern_raises_other_exceptions
1418
- skip unless RUBY_VERSION >= "3.0"
1419
-
1420
1376
  @assertion_count = 0
1421
1377
 
1422
1378
  assert_raises RuntimeError do
@@ -1427,8 +1383,6 @@ class TestMinitestAssertions < Minitest::Test
1427
1383
  end
1428
1384
 
1429
1385
  def test_refute_pattern_with_no_block
1430
- skip unless RUBY_VERSION >= "3.0"
1431
-
1432
1386
  assert_triggered "refute_pattern requires a block to capture errors." do
1433
1387
  @tc.refute_pattern
1434
1388
  end
@@ -651,7 +651,7 @@ class TestMinitestMock < Minitest::Test
651
651
 
652
652
  end
653
653
 
654
- require "minitest/metametameta"
654
+ require_relative "metametameta"
655
655
 
656
656
  class TestMinitestStub < Minitest::Test
657
657
  # Do not parallelize since we're calling stub on class methods
@@ -1,5 +1,5 @@
1
1
  require "minitest/autorun"
2
- require "minitest/metametameta"
2
+ require_relative "metametameta"
3
3
  require "forwardable"
4
4
 
5
5
  class FakeTest < Minitest::Test
@@ -29,10 +29,11 @@ class TestMinitestReporter < MetaMetaMetaTestCase
29
29
  super
30
30
  self.io = StringIO.new(+"")
31
31
  self.r = new_composite_reporter
32
+ @et = @ft = @pt = @st = @sse = nil
32
33
  end
33
34
 
34
35
  def error_test
35
- unless defined? @et then
36
+ unless @et then
36
37
  @et = FakeTest.new :woot
37
38
  @et.failures << Minitest::UnexpectedError.new(begin
38
39
  raise "no"
@@ -45,7 +46,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
45
46
  end
46
47
 
47
48
  def system_stack_error_test
48
- unless defined? @sse then
49
+ unless @sse then
49
50
 
50
51
  ex = SystemStackError.new
51
52
 
@@ -64,7 +65,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
64
65
  end
65
66
 
66
67
  def fail_test
67
- unless defined? @ft then
68
+ unless @ft then
68
69
  @ft = FakeTest.new :woot
69
70
  @ft.failures << begin
70
71
  raise Minitest::Assertion, "boo"
@@ -87,7 +88,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
87
88
  end
88
89
 
89
90
  def skip_test
90
- unless defined? @st then
91
+ unless @st then
91
92
  @st = FakeTest.new :woot
92
93
  @st.failures << begin
93
94
  raise Minitest::Skip
@@ -1,4 +1,4 @@
1
- require "minitest/metametameta"
1
+ require_relative "metametameta"
2
2
  require "stringio"
3
3
 
4
4
  class MiniSpecA < Minitest::Spec; end
@@ -148,25 +148,13 @@ describe Minitest::Spec do
148
148
  it "needs to pattern match" do
149
149
  @assertion_count = 1
150
150
 
151
- if RUBY_VERSION > "3" then
152
- expect { good_pattern }.must_pattern_match
153
- else
154
- assert_raises NotImplementedError do
155
- expect {}.must_pattern_match
156
- end
157
- end
151
+ expect { good_pattern }.must_pattern_match
158
152
  end
159
153
 
160
154
  it "needs to error on bad pattern match" do
161
- skip unless RUBY_VERSION > "3"
162
-
163
155
  @assertion_count = 1
164
156
 
165
- exp = if RUBY_VERSION.start_with? "3.0"
166
- "[1, 2, 3]" # terrible error message!
167
- else
168
- /length mismatch/
169
- end
157
+ exp = /length mismatch/
170
158
 
171
159
  assert_triggered exp do
172
160
  expect { bad_pattern }.must_pattern_match
@@ -284,7 +272,7 @@ describe Minitest::Spec do
284
272
  @assertion_count = 3
285
273
  @assertion_count += 2 unless error_on_warn? # 2 extra assertions
286
274
 
287
- exp = /DEPRECATED: Use assert_nil if expecting nil from .* This will fail in Minitest 6./
275
+ exp = /.*?test_minitest_\w+.rb:\d+: warning: DEPRECATED: Use assert_nil if expecting nil. This will fail in Minitest 6./
288
276
 
289
277
  assert_deprecation exp do
290
278
  assert_success _(nil).must_equal(nil)
@@ -1,4 +1,4 @@
1
- require "minitest/metametameta"
1
+ require_relative "metametameta"
2
2
 
3
3
  e = Encoding.default_external
4
4
  if e != Encoding::UTF_8 then
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.26.2
4
+ version: 5.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -159,13 +159,29 @@ files:
159
159
  - test/minitest/test_minitest_spec.rb
160
160
  - test/minitest/test_minitest_test.rb
161
161
  - test/minitest/test_minitest_test_task.rb
162
- homepage: https://github.com/minitest/minitest
162
+ homepage: https://minite.st/
163
163
  licenses:
164
164
  - MIT
165
165
  metadata:
166
- homepage_uri: https://github.com/minitest/minitest
166
+ homepage_uri: https://minite.st/
167
+ source_code_uri: https://github.com/minitest/minitest
167
168
  bug_tracker_uri: https://github.com/minitest/minitest/issues
168
169
  changelog_uri: https://github.com/minitest/minitest/blob/master/History.rdoc
170
+ post_install_message: |
171
+ NOTE: minitest 5 will be the last in the minitest family to support
172
+ ruby 1.8 to 2.7. If you need to keep using these versions,
173
+ you need to pin your dependency to minitest with something
174
+ like "~> 5.0". See History.rdoc to locate compatible
175
+ versions.
176
+
177
+ Further, minitest 6 will be dropping the following:
178
+
179
+ + MiniTest (it's been Minitest for >10 years)
180
+ + MiniTest::Unit
181
+ + MiniTest::Unit::TestCase
182
+ + assert_send (unless you argue for it well)
183
+ + assert_equal nil, obj
184
+ + mocks and stubs: moving minitest/mock.rb to its own gem
169
185
  rdoc_options:
170
186
  - "--main"
171
187
  - README.rdoc
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- �,YXR���f�3]L7�R /�"��t�`lޚ 5� /��vkY�l)m��3F���U')�⽃�B˴�K�O��:���l?��V\�{n
2
- dlL�t,Y�(됛&,� ��rr\� ��E�����K�%3%<�#���CE�T՚[ h\o9m�A�����r���{):8g�h�P���@�ITj`2(6T��j��;�u�d�. ��]?JF��P=��yMn����eZyY�R�!]qZ�h���R����K�;:�U2
1
+ �&#��T�d���pV ��M����F�e��s�������Έ�&o��5Eȿ3He��Ǘ�t�>hE!�1W;rl��}Yf
2
+ ��J�;�&��'*pU�'��
3
+ ������8�b�Q6��-p����N5-4�=��L 5�{#�a[�&��*����|�1��,���y˰p 2*`�Aӊ���Rf�N