minitest 5.13.0 → 5.14.4

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: 36b98534b771e1eb6b67bae4b151e957f74f7e2159b589c3527e5eb0762aaa94
4
- data.tar.gz: c5e6fab215fc67cf3133867954b55d438b00d11c1fa2df17efe456fc2ea29fb3
3
+ metadata.gz: 1edfa85bfac65503ab66f88d6ca07571a6e788bfd9eb513399cc60ffeae32e1f
4
+ data.tar.gz: 68a4cc4fcf8b54f8ba97dbda48e7ee4a8f818c67a3c4021920d5c6e4dfe9866c
5
5
  SHA512:
6
- metadata.gz: ee628ae22e60b6457c8896b86e35cef293d2bd16277b9ed55ebb7b866a98c65087ca09416c214476c821a2147e40ad3ca0a7eeab9c6ce43f19e68807b5f1753e
7
- data.tar.gz: 99c5476047e5418137429ea4d8a5ead8d6f2bca2fb5e316dcff656d083d318ee2b19b66ce2365ee639b6217ef1ad5c22fda103497953639aebb0c5876c8f0683
6
+ metadata.gz: 7f808ea45c7d6755da784bc6d70356f6beb7b794bd4df3cf509ce08d762f125c1bcafd92c406c73ea6a13809d836c75812fed83605f18b1d82e6f16b98e97004
7
+ data.tar.gz: d75f3b41034e4a70b8f372a79af5971eb2a589f87a4a80bfc20f23ebf1e5ac50235bfa5c300a25bba99f55746a8148cddde804cc9181d941ad62c71626482e06
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,46 @@
1
+ === 5.14.4 / 2021-02-23
2
+
3
+ * 1 bug fix:
4
+
5
+ * Fixed deprecation warning using stub with methods using keyword arguments. (Nakilon)
6
+
7
+ === 5.14.3 / 2021-01-05
8
+
9
+ * 1 bug fix:
10
+
11
+ * Bumped require_ruby_version to < 4 (trunk = 3.1).
12
+
13
+ === 5.14.2 / 2020-08-31
14
+
15
+ * 1 bug fix:
16
+
17
+ * Bumped ruby version to include 3.0 (trunk).
18
+
19
+ === 5.14.1 / 2020-05-15
20
+
21
+ * 3 minor enhancements:
22
+
23
+ * Minitest.filter_backtrace returns original backtrace if filter comes back empty.
24
+ * Minitest::BacktraceFilter now returns entire backtrace if $MT_DEBUG set in env.
25
+ * Return true on a successful refute. (jusleg)
26
+
27
+ * 1 bug fix:
28
+
29
+ * Fixed expectation doco to not use global expectations.
30
+
31
+ === 5.14.0 / 2020-01-11
32
+
33
+ * 2 minor enhancements:
34
+
35
+ * Block-assertions (eg assert_output) now error if raised inside the block. (casperisfine)
36
+ * Changed assert_raises to only catch Assertion since that covers Skip and friends.
37
+
38
+ * 3 bug fixes:
39
+
40
+ * Added example for value wrapper with block to Expectations module. (stomar)
41
+ * Fixed use of must/wont_be_within_delta on Expectation instance. (stomar)
42
+ * Renamed UnexpectedError#exception to #error to avoid problems with reraising. (casperisfine)
43
+
1
44
  === 5.13.0 / 2019-10-29
2
45
 
3
46
  * 9 minor enhancements:
@@ -180,7 +223,7 @@
180
223
  * 2 bug fixes:
181
224
 
182
225
  * Re-release to refresh gem certificate signing. ugh.
183
- * Fixed hoe/minitest to not augment load path if we're actually testing minitest.
226
+ * Fixed hoe/minitest to not augment load path if we're actually testing minitest.
184
227
 
185
228
  === 5.9.0 / 2016-05-16
186
229
 
@@ -204,7 +247,7 @@
204
247
  * 2 bug fixes:
205
248
 
206
249
  * Re-release to refresh gem certificate signing. ugh.
207
- * Fixed hoe/minitest to not augment load path if we're actually testing minitest.
250
+ * Fixed hoe/minitest to not augment load path if we're actually testing minitest.
208
251
 
209
252
  === 5.8.4 / 2016-01-21
210
253
 
@@ -1364,4 +1407,3 @@ back.
1364
1407
  * 1 major enhancement
1365
1408
 
1366
1409
  * Birthday!
1367
-
data/README.rdoc CHANGED
@@ -376,6 +376,42 @@ Using our example above, here is how we might implement MyCI:
376
376
 
377
377
  == FAQ
378
378
 
379
+ === What versions are compatible with what? Or what versions are supported?
380
+
381
+ Minitest is a dependency of rails, which until fairly recently had an
382
+ overzealous backwards compatibility policy. As such, I'm stuck
383
+ supporting versions of ruby that are long past EOL. Once rails 5.2 is
384
+ dropped (hopefully April 2021), I get to drop a bunch of versions of
385
+ ruby that I have to currently test against.
386
+
387
+ (As of 2021-01-31)
388
+
389
+ Current versions of rails: (https://endoflife.date/rails)
390
+
391
+ | rails | min ruby | rec ruby | minitest | status |
392
+ |-------+----------+----------+----------+----------|
393
+ | 7.0 | >= 2.7 | 3.0 | >= 5.1 | Future |
394
+ | 6.1 | >= 2.5 | 3.0 | >= 5.1 | Current |
395
+ | 6.0 | >= 2.5 | 2.6 | >= 5.1 | Security |
396
+ | 5.2 | >= 2.2.2 | 2.5 | ~> 5.1 | Security | EOL @railsconf 2021?
397
+
398
+ Current versions of ruby: (https://endoflife.date/ruby)
399
+
400
+ | ruby | Status | EOL Date |
401
+ |------+---------+------------|
402
+ | 3.0 | Current | 2024-03-31 |
403
+ | 2.7 | Maint | 2023-03-31 |
404
+ | 2.6 | Maint | 2022-03-31 |
405
+ | 2.5 | Maint* | 2021-03-31 |
406
+ | 2.4 | EOL | 2020-03-31 |
407
+ | 2.3 | EOL | 2019-03-31 |
408
+ | 2.2 | EOL | 2018-03-31 |
409
+
410
+ See also:
411
+
412
+ * https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
413
+ * https://jamesjeffersconsulting.com/ruby-rails-version-matrix/
414
+
379
415
  === How to test SimpleDelegates?
380
416
 
381
417
  The following implementation and test:
@@ -677,6 +713,7 @@ minitest-unordered :: Adds a new assertion to minitest for checking the
677
713
  contents of a collection, ignoring element order.
678
714
  minitest-vcr :: Automatic cassette managment with Minitest::Spec
679
715
  and VCR.
716
+ minitest_log :: Adds structured logging, data explication, and verdicts.
680
717
  minitest_owrapper :: Get tests results as a TestResult object.
681
718
  minitest_should :: Shoulda style syntax for minitest test::unit.
682
719
  minitest_tu_shim :: Bridges between test/unit and minitest.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ Hoe.spec "minitest" do
11
11
 
12
12
  license "MIT"
13
13
 
14
- require_ruby_version "~> 2.2"
14
+ require_ruby_version [">= 2.2", "< 4.0"]
15
15
  end
16
16
 
17
17
  desc "Find missing expectations"
@@ -21,7 +21,7 @@ task :specs do
21
21
  require "minitest/spec"
22
22
 
23
23
  pos_prefix, neg_prefix = "must", "wont"
24
- skip_re = /^(must|wont)$|wont_(throw)|must_(block|not?_|nothing|raise$)/x
24
+ skip_re = /^(must|wont)$|wont_(throw)|must_(block|not?_|nothing|send|raise$)/x
25
25
  dont_flip_re = /(must|wont)_(include|respond_to)/
26
26
 
27
27
  map = {
@@ -32,6 +32,8 @@ task :specs do
32
32
  /_includes/ => "_include",
33
33
  /(must|wont)_(.*_of|nil|silent|empty)/ => '\1_be_\2',
34
34
  /must_raises/ => "must_raise",
35
+ /(must|wont)_predicate/ => '\1_be',
36
+ /(must|wont)_path_exists/ => 'path_\1_exist',
35
37
  }
36
38
 
37
39
  expectations = Minitest::Expectations.public_instance_methods.map(&:to_s)
data/lib/minitest.rb CHANGED
@@ -8,7 +8,7 @@ require "stringio"
8
8
  # :include: README.rdoc
9
9
 
10
10
  module Minitest
11
- VERSION = "5.13.0" # :nodoc:
11
+ VERSION = "5.14.4" # :nodoc:
12
12
  ENCS = "".respond_to? :encoding # :nodoc:
13
13
 
14
14
  @@installed_at_exit ||= false
@@ -238,7 +238,9 @@ module Minitest
238
238
  end
239
239
 
240
240
  def self.filter_backtrace bt # :nodoc:
241
- backtrace_filter.filter bt
241
+ result = backtrace_filter.filter bt
242
+ result = bt.dup if result.empty?
243
+ result
242
244
  end
243
245
 
244
246
  ##
@@ -907,24 +909,21 @@ module Minitest
907
909
  # Assertion wrapping an unexpected error that was raised during a run.
908
910
 
909
911
  class UnexpectedError < Assertion
910
- attr_accessor :exception # :nodoc:
912
+ # TODO: figure out how to use `cause` instead
913
+ attr_accessor :error # :nodoc:
911
914
 
912
- def initialize exception # :nodoc:
915
+ def initialize error # :nodoc:
913
916
  super "Unexpected exception"
914
- self.exception = exception
917
+ self.error = error
915
918
  end
916
919
 
917
920
  def backtrace # :nodoc:
918
- self.exception.backtrace
919
- end
920
-
921
- def error # :nodoc:
922
- self.exception
921
+ self.error.backtrace
923
922
  end
924
923
 
925
924
  def message # :nodoc:
926
925
  bt = Minitest.filter_backtrace(self.backtrace).join "\n "
927
- "#{self.exception.class}: #{self.exception.message}\n #{bt}"
926
+ "#{self.error.class}: #{self.error.message}\n #{bt}"
928
927
  end
929
928
 
930
929
  def result_label # :nodoc:
@@ -1008,12 +1007,13 @@ module Minitest
1008
1007
  MT_RE = %r%lib/minitest% #:nodoc:
1009
1008
 
1010
1009
  ##
1011
- # Filter +bt+ to something useful. Returns the whole thing if $DEBUG.
1010
+ # Filter +bt+ to something useful. Returns the whole thing if
1011
+ # $DEBUG (ruby) or $MT_DEBUG (env).
1012
1012
 
1013
1013
  def filter bt
1014
1014
  return ["No backtrace"] unless bt
1015
1015
 
1016
- return bt.dup if $DEBUG
1016
+ return bt.dup if $DEBUG || ENV["MT_DEBUG"]
1017
1017
 
1018
1018
  new_bt = bt.take_while { |line| line !~ MT_RE }
1019
1019
  new_bt = bt.select { |line| line !~ MT_RE } if new_bt.empty?
@@ -341,6 +341,10 @@ module Minitest
341
341
  x = send out_msg, stdout, out, "In stdout" if out_msg
342
342
 
343
343
  (!stdout || x) && (!stderr || y)
344
+ rescue Assertion
345
+ raise
346
+ rescue => e
347
+ raise UnexpectedError, e
344
348
  end
345
349
 
346
350
  ##
@@ -399,7 +403,7 @@ module Minitest
399
403
  rescue *exp => e
400
404
  pass # count assertion
401
405
  return e
402
- rescue Minitest::Skip, Minitest::Assertion
406
+ rescue Minitest::Assertion # incl Skip & UnexpectedError
403
407
  # don't count assertion
404
408
  raise
405
409
  rescue SignalException, SystemExit
@@ -485,6 +489,10 @@ module Minitest
485
489
  end
486
490
 
487
491
  assert caught, message(msg) { default }
492
+ rescue Assertion
493
+ raise
494
+ rescue => e
495
+ raise UnexpectedError, e
488
496
  end
489
497
 
490
498
  ##
@@ -557,6 +565,11 @@ module Minitest
557
565
  captured_stderr.unlink
558
566
  $stdout.reopen orig_stdout
559
567
  $stderr.reopen orig_stderr
568
+
569
+ orig_stdout.close
570
+ orig_stderr.close
571
+ captured_stdout.close
572
+ captured_stderr.close
560
573
  end
561
574
  end
562
575
  end
@@ -615,7 +628,7 @@ module Minitest
615
628
 
616
629
  def refute test, msg = nil
617
630
  msg ||= message { "Expected #{mu_pp(test)} to not be truthy" }
618
- not assert !test, msg
631
+ assert !test, msg
619
632
  end
620
633
 
621
634
  ##
@@ -9,10 +9,11 @@
9
9
  #
10
10
  # it "should still work in threads" do
11
11
  # my_threaded_thingy do
12
- # (1+1).must_equal 2 # bad
13
- # assert_equal 2, 1+1 # good
14
- # _(1 + 1).must_equal 2 # good
15
- # value(1 + 1).must_equal 2 # good, also #expect
12
+ # (1+1).must_equal 2 # bad
13
+ # assert_equal 2, 1+1 # good
14
+ # _(1 + 1).must_equal 2 # good
15
+ # value(1 + 1).must_equal 2 # good, also #expect
16
+ # _ { 1 + "1" }.must_raise TypeError # good
16
17
  # end
17
18
  # end
18
19
 
@@ -21,7 +22,7 @@ module Minitest::Expectations
21
22
  ##
22
23
  # See Minitest::Assertions#assert_empty.
23
24
  #
24
- # collection.must_be_empty
25
+ # _(collection).must_be_empty
25
26
  #
26
27
  # :method: must_be_empty
27
28
 
@@ -30,7 +31,7 @@ module Minitest::Expectations
30
31
  ##
31
32
  # See Minitest::Assertions#assert_equal
32
33
  #
33
- # a.must_equal b
34
+ # _(a).must_equal b
34
35
  #
35
36
  # :method: must_equal
36
37
 
@@ -39,18 +40,18 @@ module Minitest::Expectations
39
40
  ##
40
41
  # See Minitest::Assertions#assert_in_delta
41
42
  #
42
- # n.must_be_close_to m [, delta]
43
+ # _(n).must_be_close_to m [, delta]
43
44
  #
44
45
  # :method: must_be_close_to
45
46
 
46
47
  infect_an_assertion :assert_in_delta, :must_be_close_to
47
48
 
48
- alias :must_be_within_delta :must_be_close_to # :nodoc:
49
+ infect_an_assertion :assert_in_delta, :must_be_within_delta # :nodoc:
49
50
 
50
51
  ##
51
52
  # See Minitest::Assertions#assert_in_epsilon
52
53
  #
53
- # n.must_be_within_epsilon m [, epsilon]
54
+ # _(n).must_be_within_epsilon m [, epsilon]
54
55
  #
55
56
  # :method: must_be_within_epsilon
56
57
 
@@ -59,7 +60,7 @@ module Minitest::Expectations
59
60
  ##
60
61
  # See Minitest::Assertions#assert_includes
61
62
  #
62
- # collection.must_include obj
63
+ # _(collection).must_include obj
63
64
  #
64
65
  # :method: must_include
65
66
 
@@ -68,7 +69,7 @@ module Minitest::Expectations
68
69
  ##
69
70
  # See Minitest::Assertions#assert_instance_of
70
71
  #
71
- # obj.must_be_instance_of klass
72
+ # _(obj).must_be_instance_of klass
72
73
  #
73
74
  # :method: must_be_instance_of
74
75
 
@@ -77,7 +78,7 @@ module Minitest::Expectations
77
78
  ##
78
79
  # See Minitest::Assertions#assert_kind_of
79
80
  #
80
- # obj.must_be_kind_of mod
81
+ # _(obj).must_be_kind_of mod
81
82
  #
82
83
  # :method: must_be_kind_of
83
84
 
@@ -86,7 +87,7 @@ module Minitest::Expectations
86
87
  ##
87
88
  # See Minitest::Assertions#assert_match
88
89
  #
89
- # a.must_match b
90
+ # _(a).must_match b
90
91
  #
91
92
  # :method: must_match
92
93
 
@@ -95,7 +96,7 @@ module Minitest::Expectations
95
96
  ##
96
97
  # See Minitest::Assertions#assert_nil
97
98
  #
98
- # obj.must_be_nil
99
+ # _(obj).must_be_nil
99
100
  #
100
101
  # :method: must_be_nil
101
102
 
@@ -104,11 +105,11 @@ module Minitest::Expectations
104
105
  ##
105
106
  # See Minitest::Assertions#assert_operator
106
107
  #
107
- # n.must_be :<=, 42
108
+ # _(n).must_be :<=, 42
108
109
  #
109
110
  # This can also do predicates:
110
111
  #
111
- # str.must_be :empty?
112
+ # _(str).must_be :empty?
112
113
  #
113
114
  # :method: must_be
114
115
 
@@ -117,7 +118,7 @@ module Minitest::Expectations
117
118
  ##
118
119
  # See Minitest::Assertions#assert_output
119
120
  #
120
- # proc { ... }.must_output out_or_nil [, err]
121
+ # _ { ... }.must_output out_or_nil [, err]
121
122
  #
122
123
  # :method: must_output
123
124
 
@@ -126,7 +127,7 @@ module Minitest::Expectations
126
127
  ##
127
128
  # See Minitest::Assertions#assert_raises
128
129
  #
129
- # proc { ... }.must_raise exception
130
+ # _ { ... }.must_raise exception
130
131
  #
131
132
  # :method: must_raise
132
133
 
@@ -135,7 +136,7 @@ module Minitest::Expectations
135
136
  ##
136
137
  # See Minitest::Assertions#assert_respond_to
137
138
  #
138
- # obj.must_respond_to msg
139
+ # _(obj).must_respond_to msg
139
140
  #
140
141
  # :method: must_respond_to
141
142
 
@@ -144,7 +145,7 @@ module Minitest::Expectations
144
145
  ##
145
146
  # See Minitest::Assertions#assert_same
146
147
  #
147
- # a.must_be_same_as b
148
+ # _(a).must_be_same_as b
148
149
  #
149
150
  # :method: must_be_same_as
150
151
 
@@ -153,7 +154,7 @@ module Minitest::Expectations
153
154
  ##
154
155
  # See Minitest::Assertions#assert_silent
155
156
  #
156
- # proc { ... }.must_be_silent
157
+ # _ { ... }.must_be_silent
157
158
  #
158
159
  # :method: must_be_silent
159
160
 
@@ -162,7 +163,7 @@ module Minitest::Expectations
162
163
  ##
163
164
  # See Minitest::Assertions#assert_throws
164
165
  #
165
- # proc { ... }.must_throw sym
166
+ # _ { ... }.must_throw sym
166
167
  #
167
168
  # :method: must_throw
168
169
 
@@ -189,7 +190,7 @@ module Minitest::Expectations
189
190
  ##
190
191
  # See Minitest::Assertions#refute_empty
191
192
  #
192
- # collection.wont_be_empty
193
+ # _(collection).wont_be_empty
193
194
  #
194
195
  # :method: wont_be_empty
195
196
 
@@ -198,7 +199,7 @@ module Minitest::Expectations
198
199
  ##
199
200
  # See Minitest::Assertions#refute_equal
200
201
  #
201
- # a.wont_equal b
202
+ # _(a).wont_equal b
202
203
  #
203
204
  # :method: wont_equal
204
205
 
@@ -207,18 +208,18 @@ module Minitest::Expectations
207
208
  ##
208
209
  # See Minitest::Assertions#refute_in_delta
209
210
  #
210
- # n.wont_be_close_to m [, delta]
211
+ # _(n).wont_be_close_to m [, delta]
211
212
  #
212
213
  # :method: wont_be_close_to
213
214
 
214
215
  infect_an_assertion :refute_in_delta, :wont_be_close_to
215
216
 
216
- alias :wont_be_within_delta :wont_be_close_to # :nodoc:
217
+ infect_an_assertion :refute_in_delta, :wont_be_within_delta # :nodoc:
217
218
 
218
219
  ##
219
220
  # See Minitest::Assertions#refute_in_epsilon
220
221
  #
221
- # n.wont_be_within_epsilon m [, epsilon]
222
+ # _(n).wont_be_within_epsilon m [, epsilon]
222
223
  #
223
224
  # :method: wont_be_within_epsilon
224
225
 
@@ -227,7 +228,7 @@ module Minitest::Expectations
227
228
  ##
228
229
  # See Minitest::Assertions#refute_includes
229
230
  #
230
- # collection.wont_include obj
231
+ # _(collection).wont_include obj
231
232
  #
232
233
  # :method: wont_include
233
234
 
@@ -236,7 +237,7 @@ module Minitest::Expectations
236
237
  ##
237
238
  # See Minitest::Assertions#refute_instance_of
238
239
  #
239
- # obj.wont_be_instance_of klass
240
+ # _(obj).wont_be_instance_of klass
240
241
  #
241
242
  # :method: wont_be_instance_of
242
243
 
@@ -245,7 +246,7 @@ module Minitest::Expectations
245
246
  ##
246
247
  # See Minitest::Assertions#refute_kind_of
247
248
  #
248
- # obj.wont_be_kind_of mod
249
+ # _(obj).wont_be_kind_of mod
249
250
  #
250
251
  # :method: wont_be_kind_of
251
252
 
@@ -254,7 +255,7 @@ module Minitest::Expectations
254
255
  ##
255
256
  # See Minitest::Assertions#refute_match
256
257
  #
257
- # a.wont_match b
258
+ # _(a).wont_match b
258
259
  #
259
260
  # :method: wont_match
260
261
 
@@ -263,7 +264,7 @@ module Minitest::Expectations
263
264
  ##
264
265
  # See Minitest::Assertions#refute_nil
265
266
  #
266
- # obj.wont_be_nil
267
+ # _(obj).wont_be_nil
267
268
  #
268
269
  # :method: wont_be_nil
269
270
 
@@ -272,7 +273,7 @@ module Minitest::Expectations
272
273
  ##
273
274
  # See Minitest::Assertions#refute_operator
274
275
  #
275
- # n.wont_be :<=, 42
276
+ # _(n).wont_be :<=, 42
276
277
  #
277
278
  # This can also do predicates:
278
279
  #
@@ -285,7 +286,7 @@ module Minitest::Expectations
285
286
  ##
286
287
  # See Minitest::Assertions#refute_respond_to
287
288
  #
288
- # obj.wont_respond_to msg
289
+ # _(obj).wont_respond_to msg
289
290
  #
290
291
  # :method: wont_respond_to
291
292
 
@@ -294,7 +295,7 @@ module Minitest::Expectations
294
295
  ##
295
296
  # See Minitest::Assertions#refute_same
296
297
  #
297
- # a.wont_be_same_as b
298
+ # _(a).wont_be_same_as b
298
299
  #
299
300
  # :method: wont_be_same_as
300
301
 
data/lib/minitest/mock.rb CHANGED
@@ -207,7 +207,9 @@ class Object
207
207
  # assert obj_under_test.stale?
208
208
  # end
209
209
  # end
210
- #
210
+ #--
211
+ # NOTE: keyword args in callables are NOT checked for correctness
212
+ # against the existing method. Too many edge cases to be worth it.
211
213
 
212
214
  def stub name, val_or_callable, *block_args
213
215
  new_name = "__minitest_stub__#{name}"
@@ -231,6 +233,8 @@ class Object
231
233
  end
232
234
  end
233
235
 
236
+ metaclass.send(:ruby2_keywords, name) if metaclass.respond_to?(:ruby2_keywords, true)
237
+
234
238
  yield self
235
239
  ensure
236
240
  metaclass.send :undef_method, name
@@ -6,8 +6,27 @@ class Minitest::Test
6
6
  def clean s
7
7
  s.gsub(/^ {6}/, "")
8
8
  end
9
+
10
+ def with_empty_backtrace_filter
11
+ original = Minitest.backtrace_filter
12
+
13
+ obj = Minitest::BacktraceFilter.new
14
+ def obj.filter _bt
15
+ []
16
+ end
17
+
18
+ Minitest::Test.io_lock.synchronize do # try not to trounce in parallel
19
+ begin
20
+ Minitest.backtrace_filter = obj
21
+ yield
22
+ ensure
23
+ Minitest.backtrace_filter = original
24
+ end
25
+ end
26
+ end
9
27
  end
10
28
 
29
+
11
30
  class FakeNamedTest < Minitest::Test
12
31
  @@count = 0
13
32
 
@@ -77,6 +77,14 @@ class TestMinitestAssertions < Minitest::Test
77
77
  self.send assert_msg, expected, msg
78
78
  end
79
79
 
80
+ def assert_unexpected expected
81
+ expected = Regexp.new expected if String === expected
82
+
83
+ assert_triggered expected, Minitest::UnexpectedError do
84
+ yield
85
+ end
86
+ end
87
+
80
88
  def clean s
81
89
  s.gsub(/^ {6,10}/, "")
82
90
  end
@@ -603,12 +611,117 @@ class TestMinitestAssertions < Minitest::Test
603
611
  end
604
612
  end
605
613
 
606
- def test_assert_output_without_block
614
+ def test_assert_output_no_block
607
615
  assert_triggered "assert_output requires a block to capture output." do
608
616
  @tc.assert_output "blah"
609
617
  end
610
618
  end
611
619
 
620
+ def test_assert_output_nested_assert_uncaught
621
+ @assertion_count = 1
622
+
623
+ assert_triggered "Epic Fail!" do
624
+ @tc.assert_output "blah\n" do
625
+ puts "blah"
626
+ @tc.flunk
627
+ end
628
+ end
629
+ end
630
+
631
+ def test_assert_output_nested_raise
632
+ @assertion_count = 2
633
+
634
+ @tc.assert_output "blah\n" do
635
+ @tc.assert_raises RuntimeError do
636
+ puts "blah"
637
+ raise "boom!"
638
+ end
639
+ end
640
+ end
641
+
642
+ def test_assert_output_nested_raise_bad
643
+ @assertion_count = 0
644
+
645
+ assert_unexpected "boom!" do
646
+ @tc.assert_raises do # 2) bypassed via UnexpectedError
647
+ @tc.assert_output "blah\n" do # 1) captures and raises UnexpectedError
648
+ puts "not_blah"
649
+ raise "boom!"
650
+ end
651
+ end
652
+ end
653
+ end
654
+
655
+ def test_assert_output_nested_raise_mismatch
656
+ # this test is redundant, but illustrative
657
+ @assertion_count = 0
658
+
659
+ assert_unexpected "boom!" do
660
+ @tc.assert_raises RuntimeError do # 2) bypassed via UnexpectedError
661
+ @tc.assert_output "blah\n" do # 1) captures and raises UnexpectedError
662
+ puts "not_blah"
663
+ raise ArgumentError, "boom!"
664
+ end
665
+ end
666
+ end
667
+ end
668
+
669
+ def test_assert_output_nested_throw_caught
670
+ @assertion_count = 2
671
+
672
+ @tc.assert_output "blah\n" do
673
+ @tc.assert_throws :boom! do
674
+ puts "blah"
675
+ throw :boom!
676
+ end
677
+ end
678
+ end
679
+
680
+ def test_assert_output_nested_throw_caught_bad
681
+ @assertion_count = 1 # want 0; can't prevent throw from escaping :(
682
+
683
+ @tc.assert_throws :boom! do # 2) captured via catch
684
+ @tc.assert_output "blah\n" do # 1) bypassed via throw
685
+ puts "not_blah"
686
+ throw :boom!
687
+ end
688
+ end
689
+ end
690
+
691
+ def test_assert_output_nested_throw_mismatch
692
+ @assertion_count = 0
693
+
694
+ assert_unexpected "uncaught throw :boom!" do
695
+ @tc.assert_throws :not_boom! do # 2) captured via assert_throws+rescue
696
+ @tc.assert_output "blah\n" do # 1) bypassed via throw
697
+ puts "not_blah"
698
+ throw :boom!
699
+ end
700
+ end
701
+ end
702
+ end
703
+
704
+ def test_assert_output_uncaught_raise
705
+ @assertion_count = 0
706
+
707
+ assert_unexpected "RuntimeError: boom!" do
708
+ @tc.assert_output "blah\n" do
709
+ puts "not_blah"
710
+ raise "boom!"
711
+ end
712
+ end
713
+ end
714
+
715
+ def test_assert_output_uncaught_throw
716
+ @assertion_count = 0
717
+
718
+ assert_unexpected "uncaught throw :boom!" do
719
+ @tc.assert_output "blah\n" do
720
+ puts "not_blah"
721
+ throw :boom!
722
+ end
723
+ end
724
+ end
612
725
  def test_assert_predicate
613
726
  @tc.assert_predicate "", :empty?
614
727
  end
@@ -671,6 +784,19 @@ class TestMinitestAssertions < Minitest::Test
671
784
  end
672
785
  end
673
786
 
787
+ def test_assert_raises_throw_nested_bad
788
+ @assertion_count = 0
789
+
790
+ assert_unexpected "RuntimeError: boom!" do
791
+ @tc.assert_raises do
792
+ @tc.assert_throws :blah do
793
+ raise "boom!"
794
+ throw :not_blah
795
+ end
796
+ end
797
+ end
798
+ end
799
+
674
800
  ##
675
801
  # *sigh* This is quite an odd scenario, but it is from real (albeit
676
802
  # ugly) test code in ruby-core:
@@ -875,7 +1001,9 @@ class TestMinitestAssertions < Minitest::Test
875
1001
  end
876
1002
 
877
1003
  def test_assert_throws_argument_exception
878
- @tc.assert_raises ArgumentError do
1004
+ @assertion_count = 0
1005
+
1006
+ assert_unexpected "ArgumentError" do
879
1007
  @tc.assert_throws :blah do
880
1008
  raise ArgumentError
881
1009
  end
@@ -891,7 +1019,9 @@ class TestMinitestAssertions < Minitest::Test
891
1019
  end
892
1020
 
893
1021
  def test_assert_throws_name_error
894
- @tc.assert_raises NameError do
1022
+ @assertion_count = 0
1023
+
1024
+ assert_unexpected "NameError" do
895
1025
  @tc.assert_throws :blah do
896
1026
  raise NameError
897
1027
  end
@@ -988,16 +1118,20 @@ class TestMinitestAssertions < Minitest::Test
988
1118
  end
989
1119
  end
990
1120
 
1121
+ def assert_fail_after t
1122
+ @tc.fail_after t.year, t.month, t.day, "remove the deprecations"
1123
+ end
1124
+
991
1125
  def test_fail_after
992
- t = Time.now
993
- y, m, d = t.year, t.month, t.day
1126
+ d0 = Time.now
1127
+ d1 = d0 + 86_400 # I am an idiot
994
1128
 
995
1129
  assert_silent do
996
- @tc.fail_after y, m, d+1, "remove the deprecations"
1130
+ assert_fail_after d1
997
1131
  end
998
1132
 
999
1133
  assert_triggered "remove the deprecations" do
1000
- @tc.fail_after y, m, d, "remove the deprecations"
1134
+ assert_fail_after d0
1001
1135
  end
1002
1136
  end
1003
1137
 
@@ -1020,7 +1154,7 @@ class TestMinitestAssertions < Minitest::Test
1020
1154
  def test_refute
1021
1155
  @assertion_count = 2
1022
1156
 
1023
- @tc.assert_equal false, @tc.refute(false), "returns false on success"
1157
+ @tc.assert_equal true, @tc.refute(false), "returns true on success"
1024
1158
  end
1025
1159
 
1026
1160
  def test_refute_empty
@@ -1212,18 +1346,22 @@ class TestMinitestAssertions < Minitest::Test
1212
1346
  end
1213
1347
  end
1214
1348
 
1349
+ def assert_skip_until t, msg
1350
+ @tc.skip_until t.year, t.month, t.day, msg
1351
+ end
1352
+
1215
1353
  def test_skip_until
1216
1354
  @assertion_count = 0
1217
1355
 
1218
- t = Time.now
1219
- y, m, d = t.year, t.month, t.day
1356
+ d0 = Time.now
1357
+ d1 = d0 + 86_400 # I am an idiot
1220
1358
 
1221
1359
  assert_output "", /Stale skip_until \"not yet\" at .*?:\d+$/ do
1222
- @tc.skip_until y, m, d, "not yet"
1360
+ assert_skip_until d0, "not yet"
1223
1361
  end
1224
1362
 
1225
1363
  assert_triggered "not ready yet", Minitest::Skip do
1226
- @tc.skip_until y, m, d+1, "not ready yet"
1364
+ assert_skip_until d1, "not ready yet"
1227
1365
  end
1228
1366
  end
1229
1367
 
@@ -591,6 +591,18 @@ class TestMinitestStub < Minitest::Test
591
591
  end
592
592
  end
593
593
 
594
+ class Keywords
595
+ def self.args req, kw1:, kw2:24
596
+ [req, kw1, kw2]
597
+ end
598
+ end
599
+
600
+ def test_stub_callable_keyword_args
601
+ Keywords.stub :args, ->(*args, **kws) { [args, kws] } do
602
+ @tc.assert_equal [["woot"], { kw1: 42 }], Keywords.args("woot", kw1: 42)
603
+ end
604
+ end
605
+
594
606
  def test_stub_callable_block_5 # from tenderlove
595
607
  @assertion_count += 1
596
608
  Foo.stub5 :blocking, Bar.new do
@@ -43,6 +43,10 @@ describe Minitest::Spec do
43
43
  end
44
44
  end
45
45
 
46
+ def assert_success spec
47
+ assert_equal true, spec
48
+ end
49
+
46
50
  before do
47
51
  @assertion_count = 4
48
52
  end
@@ -62,7 +66,7 @@ describe Minitest::Spec do
62
66
  it "needs to check for file existence" do
63
67
  @assertion_count = 3
64
68
 
65
- _(_(__FILE__).path_must_exist).must_equal true
69
+ assert_success _(__FILE__).path_must_exist
66
70
 
67
71
  assert_triggered "Expected path 'blah' to exist." do
68
72
  _("blah").path_must_exist
@@ -72,7 +76,7 @@ describe Minitest::Spec do
72
76
  it "needs to check for file non-existence" do
73
77
  @assertion_count = 3
74
78
 
75
- _(_("blah").path_wont_exist).must_equal false
79
+ assert_success _("blah").path_wont_exist
76
80
 
77
81
  assert_triggered "Expected path '#{__FILE__}' to not exist." do
78
82
  _(__FILE__).path_wont_exist
@@ -82,7 +86,7 @@ describe Minitest::Spec do
82
86
  it "needs to be sensible about must_include order" do
83
87
  @assertion_count += 3 # must_include is 2 assertions
84
88
 
85
- _(_([1, 2, 3]).must_include(2)).must_equal true
89
+ assert_success _([1, 2, 3]).must_include(2)
86
90
 
87
91
  assert_triggered "Expected [1, 2, 3] to include 5." do
88
92
  _([1, 2, 3]).must_include 5
@@ -96,7 +100,7 @@ describe Minitest::Spec do
96
100
  it "needs to be sensible about wont_include order" do
97
101
  @assertion_count += 3 # wont_include is 2 assertions
98
102
 
99
- _(_([1, 2, 3]).wont_include(5)).must_equal false
103
+ assert_success _([1, 2, 3]).wont_include(5)
100
104
 
101
105
  assert_triggered "Expected [1, 2, 3] to not include 2." do
102
106
  _([1, 2, 3]).wont_include 2
@@ -137,7 +141,7 @@ describe Minitest::Spec do
137
141
  @assertion_count -= 1 # no msg
138
142
  @assertion_count += 2 # assert_output is 2 assertions
139
143
 
140
- _(expect {}.must_be_silent).must_equal true
144
+ assert_success expect {}.must_be_silent
141
145
 
142
146
  assert_triggered "In stdout.\nExpected: \"\"\n Actual: \"xxx\"" do
143
147
  expect { print "xxx" }.must_be_silent
@@ -195,7 +199,7 @@ describe Minitest::Spec do
195
199
  end
196
200
 
197
201
  it "needs to verify binary messages" do
198
- _(_(42).wont_be(:<, 24)).must_equal false
202
+ assert_success _(42).wont_be(:<, 24)
199
203
 
200
204
  assert_triggered "Expected 24 to not be < 42." do
201
205
  _(24).wont_be :<, 42
@@ -209,7 +213,7 @@ describe Minitest::Spec do
209
213
  it "needs to verify emptyness" do
210
214
  @assertion_count += 3 # empty is 2 assertions
211
215
 
212
- _(_([]).must_be_empty).must_equal true
216
+ assert_success _([]).must_be_empty
213
217
 
214
218
  assert_triggered "Expected [42] to be empty." do
215
219
  _([42]).must_be_empty
@@ -223,7 +227,7 @@ describe Minitest::Spec do
223
227
  it "needs to verify equality" do
224
228
  @assertion_count += 1
225
229
 
226
- _(_(6 * 7).must_equal(42)).must_equal true
230
+ assert_success _(6 * 7).must_equal(42)
227
231
 
228
232
  assert_triggered "Expected: 42\n Actual: 54" do
229
233
  _(6 * 9).must_equal 42
@@ -242,7 +246,7 @@ describe Minitest::Spec do
242
246
  @assertion_count += 1 # extra test
243
247
 
244
248
  out, err = capture_io do
245
- _(_(nil).must_equal(nil)).must_equal true
249
+ assert_success _(nil).must_equal(nil)
246
250
  end
247
251
 
248
252
  exp = "DEPRECATED: Use assert_nil if expecting nil from #{__FILE__}:#{__LINE__-3}. " \
@@ -256,7 +260,7 @@ describe Minitest::Spec do
256
260
  it "needs to verify floats outside a delta" do
257
261
  @assertion_count += 1 # extra test
258
262
 
259
- _(_(24).wont_be_close_to(42)).must_equal false
263
+ assert_success _(24).wont_be_close_to(42)
260
264
 
261
265
  assert_triggered "Expected |42 - 42.0| (0.0) to not be <= 0.001." do
262
266
  _(6 * 7.0).wont_be_close_to 42
@@ -275,7 +279,7 @@ describe Minitest::Spec do
275
279
  it "needs to verify floats outside an epsilon" do
276
280
  @assertion_count += 1 # extra test
277
281
 
278
- _(_(24).wont_be_within_epsilon(42)).must_equal false
282
+ assert_success _(24).wont_be_within_epsilon(42)
279
283
 
280
284
  x = "0.042"
281
285
  assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
@@ -295,7 +299,7 @@ describe Minitest::Spec do
295
299
  it "needs to verify floats within a delta" do
296
300
  @assertion_count += 1 # extra test
297
301
 
298
- _(_(6.0 * 7).must_be_close_to(42.0)).must_equal true
302
+ assert_success _(6.0 * 7).must_be_close_to(42.0)
299
303
 
300
304
  assert_triggered "Expected |0.0 - 0.01| (0.01) to be <= 0.001." do
301
305
  _(1.0 / 100).must_be_close_to 0.0
@@ -314,7 +318,7 @@ describe Minitest::Spec do
314
318
  it "needs to verify floats within an epsilon" do
315
319
  @assertion_count += 1 # extra test
316
320
 
317
- _(_(6.0 * 7).must_be_within_epsilon(42.0)).must_equal true
321
+ assert_success _(6.0 * 7).must_be_within_epsilon(42.0)
318
322
 
319
323
  assert_triggered "Expected |0.0 - 0.01| (0.01) to be <= 0.0." do
320
324
  _(1.0 / 100).must_be_within_epsilon 0.0
@@ -330,7 +334,7 @@ describe Minitest::Spec do
330
334
  end
331
335
 
332
336
  it "needs to verify identity" do
333
- _(_(1).must_be_same_as(1)).must_equal true
337
+ assert_success _(1).must_be_same_as(1)
334
338
 
335
339
  assert_triggered "Expected 1 (oid=N) to be the same as 2 (oid=N)." do
336
340
  _(1).must_be_same_as 2
@@ -343,8 +347,8 @@ describe Minitest::Spec do
343
347
 
344
348
  it "needs to verify inequality" do
345
349
  @assertion_count += 2
346
- _(_(42).wont_equal(6 * 9)).must_equal false
347
- _(_(proc {}).wont_equal(42)).must_equal false
350
+ assert_success _(42).wont_equal(6 * 9)
351
+ assert_success _(proc {}).wont_equal(42)
348
352
 
349
353
  assert_triggered "Expected 1 to not be equal to 1." do
350
354
  _(1).wont_equal 1
@@ -356,7 +360,7 @@ describe Minitest::Spec do
356
360
  end
357
361
 
358
362
  it "needs to verify instances of a class" do
359
- _(_(42).wont_be_instance_of(String)).must_equal false
363
+ assert_success _(42).wont_be_instance_of(String)
360
364
 
361
365
  assert_triggered "Expected 42 to not be a kind of #{Int.name}." do
362
366
  _(42).wont_be_kind_of Int
@@ -370,8 +374,8 @@ describe Minitest::Spec do
370
374
  it "needs to verify kinds of a class" do
371
375
  @assertion_count += 2
372
376
 
373
- _(_(42).wont_be_kind_of(String)).must_equal false
374
- _(_(proc {}).wont_be_kind_of(String)).must_equal false
377
+ assert_success _(42).wont_be_kind_of(String)
378
+ assert_success _(proc {}).wont_be_kind_of(String)
375
379
 
376
380
  assert_triggered "Expected 42 to not be a kind of #{Int.name}." do
377
381
  _(42).wont_be_kind_of Int
@@ -385,8 +389,8 @@ describe Minitest::Spec do
385
389
  it "needs to verify kinds of objects" do
386
390
  @assertion_count += 3 # extra test
387
391
 
388
- _(_(6 * 7).must_be_kind_of(Int)).must_equal true
389
- _(_(6 * 7).must_be_kind_of(Numeric)).must_equal true
392
+ assert_success _(6 * 7).must_be_kind_of(Int)
393
+ assert_success _(6 * 7).must_be_kind_of(Numeric)
390
394
 
391
395
  assert_triggered "Expected 42 to be a kind of String, not #{Int.name}." do
392
396
  _(6 * 7).must_be_kind_of String
@@ -405,7 +409,7 @@ describe Minitest::Spec do
405
409
  it "needs to verify mismatch" do
406
410
  @assertion_count += 3 # match is 2
407
411
 
408
- _(_("blah").wont_match(/\d+/)).must_equal false
412
+ assert_success _("blah").wont_match(/\d+/)
409
413
 
410
414
  assert_triggered "Expected /\\w+/ to not match \"blah\"." do
411
415
  _("blah").wont_match(/\w+/)
@@ -417,7 +421,7 @@ describe Minitest::Spec do
417
421
  end
418
422
 
419
423
  it "needs to verify nil" do
420
- _(_(nil).must_be_nil).must_equal true
424
+ assert_success _(nil).must_be_nil
421
425
 
422
426
  assert_triggered "Expected 42 to be nil." do
423
427
  _(42).must_be_nil
@@ -431,7 +435,7 @@ describe Minitest::Spec do
431
435
  it "needs to verify non-emptyness" do
432
436
  @assertion_count += 3 # empty is 2 assertions
433
437
 
434
- _(_(["some item"]).wont_be_empty).must_equal false
438
+ assert_success _(["some item"]).wont_be_empty
435
439
 
436
440
  assert_triggered "Expected [] to not be empty." do
437
441
  _([]).wont_be_empty
@@ -443,7 +447,7 @@ describe Minitest::Spec do
443
447
  end
444
448
 
445
449
  it "needs to verify non-identity" do
446
- _(_(1).wont_be_same_as(2)).must_equal false
450
+ assert_success _(1).wont_be_same_as(2)
447
451
 
448
452
  assert_triggered "Expected 1 (oid=N) to not be the same as 1 (oid=N)." do
449
453
  _(1).wont_be_same_as 1
@@ -455,7 +459,7 @@ describe Minitest::Spec do
455
459
  end
456
460
 
457
461
  it "needs to verify non-nil" do
458
- _(_(42).wont_be_nil).must_equal false
462
+ assert_success _(42).wont_be_nil
459
463
 
460
464
  assert_triggered "Expected nil to not be nil." do
461
465
  _(nil).wont_be_nil
@@ -467,7 +471,7 @@ describe Minitest::Spec do
467
471
  end
468
472
 
469
473
  it "needs to verify objects not responding to a message" do
470
- _(_("").wont_respond_to(:woot!)).must_equal false
474
+ assert_success _("").wont_respond_to(:woot!)
471
475
 
472
476
  assert_triggered "Expected \"\" to not respond to to_s." do
473
477
  _("").wont_respond_to :to_s
@@ -481,7 +485,7 @@ describe Minitest::Spec do
481
485
  it "needs to verify output in stderr" do
482
486
  @assertion_count -= 1 # no msg
483
487
 
484
- _(expect { $stderr.print "blah" }.must_output(nil, "blah")).must_equal true
488
+ assert_success expect { $stderr.print "blah" }.must_output(nil, "blah")
485
489
 
486
490
  assert_triggered "In stderr.\nExpected: \"blah\"\n Actual: \"xxx\"" do
487
491
  expect { $stderr.print "xxx" }.must_output(nil, "blah")
@@ -491,7 +495,7 @@ describe Minitest::Spec do
491
495
  it "needs to verify output in stdout" do
492
496
  @assertion_count -= 1 # no msg
493
497
 
494
- _(expect { print "blah" }.must_output("blah")).must_equal true
498
+ assert_success expect { print "blah" }.must_output("blah")
495
499
 
496
500
  assert_triggered "In stdout.\nExpected: \"blah\"\n Actual: \"xxx\"" do
497
501
  expect { print "xxx" }.must_output("blah")
@@ -501,7 +505,7 @@ describe Minitest::Spec do
501
505
  it "needs to verify regexp matches" do
502
506
  @assertion_count += 3 # must_match is 2 assertions
503
507
 
504
- _(_("blah").must_match(/\w+/)).must_equal true
508
+ assert_success _("blah").must_match(/\w+/)
505
509
 
506
510
  assert_triggered "Expected /\\d+/ to match \"blah\"." do
507
511
  _("blah").must_match(/\d+/)
@@ -567,12 +571,28 @@ describe Minitest::Spec do
567
571
  (1 + 1).must_equal 2
568
572
  end
569
573
  end
574
+
575
+ # https://github.com/seattlerb/minitest/issues/837
576
+ # https://github.com/rails/rails/pull/39304
577
+ it "deprecates expectation used without _ with empty backtrace_filter" do
578
+ skip "N/A" if ENV["MT_NO_EXPECTATIONS"]
579
+
580
+ @assertion_count += 3
581
+
582
+ exp = /DEPRECATED: global use of must_equal from/
583
+
584
+ with_empty_backtrace_filter do
585
+ assert_output "", exp do
586
+ (1 + 1).must_equal 2
587
+ end
588
+ end
589
+ end
570
590
  end
571
591
 
572
592
  it "needs to verify throw" do
573
593
  @assertion_count += 2 # 2 extra tests
574
594
 
575
- _(expect { throw :blah }.must_throw(:blah)).must_equal true
595
+ assert_success expect { throw :blah }.must_throw(:blah)
576
596
 
577
597
  assert_triggered "Expected :blah to have been thrown." do
578
598
  expect {}.must_throw :blah
@@ -592,7 +612,7 @@ describe Minitest::Spec do
592
612
  end
593
613
 
594
614
  it "needs to verify types of objects" do
595
- _(_(6 * 7).must_be_instance_of(Int)).must_equal true
615
+ assert_success _(6 * 7).must_be_instance_of(Int)
596
616
 
597
617
  exp = "Expected 42 to be an instance of String, not #{Int.name}."
598
618
 
@@ -608,7 +628,7 @@ describe Minitest::Spec do
608
628
  it "needs to verify using any (negative) predicate" do
609
629
  @assertion_count -= 1 # doesn"t take a message
610
630
 
611
- _(_("blah").wont_be(:empty?)).must_equal false
631
+ assert_success _("blah").wont_be(:empty?)
612
632
 
613
633
  assert_triggered "Expected \"\" to not be empty?." do
614
634
  _("").wont_be :empty?
@@ -618,7 +638,7 @@ describe Minitest::Spec do
618
638
  it "needs to verify using any binary operator" do
619
639
  @assertion_count -= 1 # no msg
620
640
 
621
- _(_(41).must_be(:<, 42)).must_equal true
641
+ assert_success _(41).must_be(:<, 42)
622
642
 
623
643
  assert_triggered "Expected 42 to be < 41." do
624
644
  _(42).must_be(:<, 41)
@@ -628,7 +648,7 @@ describe Minitest::Spec do
628
648
  it "needs to verify using any predicate" do
629
649
  @assertion_count -= 1 # no msg
630
650
 
631
- _(_("").must_be(:empty?)).must_equal true
651
+ assert_success _("").must_be(:empty?)
632
652
 
633
653
  assert_triggered "Expected \"blah\" to be empty?." do
634
654
  _("blah").must_be :empty?
@@ -636,7 +656,7 @@ describe Minitest::Spec do
636
656
  end
637
657
 
638
658
  it "needs to verify using respond_to" do
639
- _(_(42).must_respond_to(:+)).must_equal true
659
+ assert_success _(42).must_respond_to(:+)
640
660
 
641
661
  assert_triggered "Expected 42 (#{Int.name}) to respond to #clear." do
642
662
  _(42).must_respond_to :clear
@@ -75,9 +75,13 @@ class TestMinitestUnit < MetaMetaMetaTestCase
75
75
  assert_equal ex, fu
76
76
  end
77
77
 
78
- # def test_default_runner_is_minitest_unit
79
- # assert_instance_of Minitest::Unit, Minitest::Unit.runner
80
- # end
78
+ def test_filter_backtrace__empty
79
+ with_empty_backtrace_filter do
80
+ bt = %w[first second third]
81
+ fu = Minitest.filter_backtrace bt.dup
82
+ assert_equal bt, fu
83
+ end
84
+ end
81
85
 
82
86
  def test_infectious_binary_encoding
83
87
  @tu = Class.new FakeNamedTest do
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.13.0
4
+ version: 5.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBBTANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE4MTIwNDIxMzAxNFoXDTE5MTIwNDIxMzAxNFowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTIwMTIyMjIwMzgzMFoXDTIxMTIyMjIwMzgzMFowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,14 +22,14 @@ cert_chain:
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
23
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
24
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
25
- AQCbJwLmpJR2PomLU+Zzw3KRzH/hbyUWc/ftru71AopZ1fy4iY9J/BW5QYKVYwbP
26
- V0FSBWtvfI/RdwfKGtuGhPKECZgmLieGuZ3XCc09qPu1bdg7i/tu1p0t0c6163ku
27
- nDMDIC/t/DAFK0TY9I3HswuyZGbLW7rgF0DmiuZdN/RPhHq2pOLMLXJmFclCb/im
28
- 9yToml/06TJdUJ5p64mkBs0TzaK66DIB1Smd3PdtfZqoRV+EwaXMdx0Hb3zdR1JR
29
- Em82dBUFsipwMLCYj39kcyHWAxyl6Ae1Cn9r/ItVBCxoeFdrHjfavnrIEoXUt4bU
30
- UfBugfLD19bu3nvL+zTAGx/U
25
+ AQAE3XRm1YZcCVjAJy5yMZvTOFrS7B2SYErc+0QwmKYbHztTTDY2m5Bii+jhpuxh
26
+ H+ETcU1z8TUKLpsBUP4kUpIRowkVN1p/jKapV8T3Rbwq+VuYFe+GMKsf8wGZSecG
27
+ oMQ8DzzauZfbvhe2kDg7G9BBPU0wLQlY25rDcCy9bLnD7R0UK3ONqpwvsI5I7x5X
28
+ ZIMXR0a9/DG+55mawwdGzCQobDKiSNLK89KK7OcNTALKU0DfgdTkktdgKchzKHqZ
29
+ d/AHw/kcnU6iuMUoJEcGiJd4gVCTn1l3cDcIvxakGslCA88Jubw0Sqatan0TnC9g
30
+ KToW560QIey7SPfHWduzFJnV
31
31
  -----END CERTIFICATE-----
32
- date: 2019-10-30 00:00:00.000000000 Z
32
+ date: 2021-02-24 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rdoc
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '3.18'
60
+ version: '3.22'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '3.18'
67
+ version: '3.22'
68
68
  description: |-
69
69
  minitest provides a complete suite of testing facilities supporting
70
70
  TDD, BDD, mocking, and benchmarking.
@@ -158,8 +158,10 @@ files:
158
158
  homepage: https://github.com/seattlerb/minitest
159
159
  licenses:
160
160
  - MIT
161
- metadata: {}
162
- post_install_message:
161
+ metadata:
162
+ homepage_uri: https://github.com/seattlerb/minitest
163
+ bug_tracker_uri: https://github.com/seattlerb/minitest/issues
164
+ post_install_message:
163
165
  rdoc_options:
164
166
  - "--main"
165
167
  - README.rdoc
@@ -167,17 +169,20 @@ require_paths:
167
169
  - lib
168
170
  required_ruby_version: !ruby/object:Gem::Requirement
169
171
  requirements:
170
- - - "~>"
172
+ - - ">="
171
173
  - !ruby/object:Gem::Version
172
174
  version: '2.2'
175
+ - - "<"
176
+ - !ruby/object:Gem::Version
177
+ version: '4.0'
173
178
  required_rubygems_version: !ruby/object:Gem::Requirement
174
179
  requirements:
175
180
  - - ">="
176
181
  - !ruby/object:Gem::Version
177
182
  version: '0'
178
183
  requirements: []
179
- rubygems_version: 3.0.6
180
- signing_key:
184
+ rubygems_version: 3.1.4
185
+ signing_key:
181
186
  specification_version: 4
182
187
  summary: minitest provides a complete suite of testing facilities supporting TDD,
183
188
  BDD, mocking, and benchmarking
metadata.gz.sig CHANGED
Binary file