minitest 5.17.0 → 5.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +30 -0
- data/README.rdoc +10 -9
- data/Rakefile +1 -0
- data/lib/minitest/assertions.rb +50 -0
- data/lib/minitest/expectations.rb +18 -0
- data/lib/minitest/mock.rb +1 -1
- data/lib/minitest/test.rb +2 -10
- data/lib/minitest/test_task.rb +4 -7
- data/lib/minitest.rb +53 -13
- data/test/minitest/test_minitest_assertions.rb +110 -0
- data/test/minitest/test_minitest_mock.rb +1 -1
- data/test/minitest/test_minitest_reporter.rb +29 -0
- data/test/minitest/test_minitest_spec.rb +41 -0
- data.tar.gz.sig +0 -0
- metadata +6 -6
- metadata.gz.sig +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90d1006243ab84a197a234948e0256bba3cbecbfb1d5d62d55b44ed5422d7eed
|
4
|
+
data.tar.gz: 2b526508669eab5c8578c2075fe8a8a83f1434a609c09667888020142e9326b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6614896f10af7da66d1327f6ba5e0565458df8567d5687dddf02ee91dc3ece9332d7ffb706c9a3b093deaaec13f8ddf8f017d5f90ba8d18975bb6ebcb8a313d0
|
7
|
+
data.tar.gz: eff4fefb8a32661c3e0fdf80a7b3c4cfc81f6e9dcd160a40aef3e49e6d82cf1c5b6bff92fc0faaf8dab6334049c11f54e18d95a745c82e8aecfb3533ed7b3194
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
=== 5.19.0 / 2023-07-26
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Add metadata lazy accessor to Runnable / Result. (matteeyah)
|
6
|
+
* Only load minitest/unit (aka ancient MiniTest compatibility layer) if ENV["MT_COMPAT"]
|
7
|
+
|
8
|
+
* 1 bug fix:
|
9
|
+
|
10
|
+
* Minitest::TestTask enthusiastically added itself to default. (ParadoxV5)
|
11
|
+
|
12
|
+
=== 5.18.1 / 2023-06-16
|
13
|
+
|
14
|
+
* 3 bug fixes:
|
15
|
+
|
16
|
+
* Avoid extra string allocations when filtering tests. (tenderlove)
|
17
|
+
* Only mention deprecated ENV['N'] if it is an integer string.
|
18
|
+
* Push up test_order to Minitest::Runnable to fix minitest/hell. (koic)
|
19
|
+
|
20
|
+
=== 5.18.0 / 2023-03-04
|
21
|
+
|
22
|
+
* 2 major enhancements:
|
23
|
+
|
24
|
+
* Added assert_pattern & refute_pattern for pattern matching. (flavorjones)
|
25
|
+
* Added matching must_pattern_match & wont_pattern_match to minitest/spec.
|
26
|
+
|
27
|
+
* 1 bug fix:
|
28
|
+
|
29
|
+
* Support the new message format of NameError in Ruby 3.3 (mame)
|
30
|
+
|
1
31
|
=== 5.17.0 / 2022-12-31
|
2
32
|
|
3
33
|
* 1 minor enhancement:
|
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= minitest/{test,spec,mock,benchmark}
|
2
2
|
|
3
|
-
home :: https://github.com/
|
4
|
-
bugs :: https://github.com/
|
3
|
+
home :: https://github.com/minitest/minitest
|
4
|
+
bugs :: https://github.com/minitest/minitest/issues
|
5
5
|
rdoc :: https://docs.seattlerb.org/minitest
|
6
6
|
vim :: https://github.com/sunaku/vim-ruby-minitest
|
7
7
|
emacs:: https://github.com/arthurnn/minitest-emacs
|
@@ -411,7 +411,7 @@ supporting versions of ruby that are long past EOL. Hopefully I'll be
|
|
411
411
|
able to support only current versions of ruby sometime in the near
|
412
412
|
future.
|
413
413
|
|
414
|
-
(As of
|
414
|
+
(As of 2023-03-05)
|
415
415
|
|
416
416
|
Current versions of rails: (https://endoflife.date/rails)
|
417
417
|
|
@@ -422,20 +422,21 @@ Current versions of rails: (https://endoflife.date/rails)
|
|
422
422
|
| 6.0 | >= 2.5 | 2.6 | >= 5.1 | Security | 2023-06-01 |
|
423
423
|
| 5.2 | >= 2.2.2 | 2.5 | ~> 5.1 | EOL | 2022-06-01 |
|
424
424
|
|
425
|
+
If you want to look at the requirements for a specific version, run:
|
426
|
+
|
427
|
+
gem spec -r --ruby rails -v 7.0.0
|
428
|
+
|
425
429
|
Current versions of ruby: (https://endoflife.date/ruby)
|
426
430
|
|
427
431
|
| ruby | Status | EOL Date |
|
428
432
|
|------+---------+------------|
|
429
|
-
| 3.
|
433
|
+
| 3.2 | Current | 2026-03-31 |
|
434
|
+
| 3.1 | Maint | 2025-03-31 |
|
430
435
|
| 3.0 | Maint | 2024-03-31 |
|
431
|
-
| 2.7 |
|
436
|
+
| 2.7 | Security| 2023-03-31 |
|
432
437
|
| 2.6 | EOL | 2022-03-31 |
|
433
438
|
| 2.5 | EOL | 2021-03-31 |
|
434
439
|
|
435
|
-
See also:
|
436
|
-
|
437
|
-
* https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
|
438
|
-
|
439
440
|
=== How to test SimpleDelegates?
|
440
441
|
|
441
442
|
The following implementation and test:
|
data/Rakefile
CHANGED
data/lib/minitest/assertions.rb
CHANGED
@@ -357,6 +357,32 @@ module Minitest
|
|
357
357
|
assert File.exist?(path), msg
|
358
358
|
end
|
359
359
|
|
360
|
+
##
|
361
|
+
# For testing with pattern matching (only supported with Ruby 3.0 and later)
|
362
|
+
#
|
363
|
+
# # pass
|
364
|
+
# assert_pattern { [1,2,3] => [Integer, Integer, Integer] }
|
365
|
+
#
|
366
|
+
# # fail "length mismatch (given 3, expected 1)"
|
367
|
+
# assert_pattern { [1,2,3] => [Integer] }
|
368
|
+
#
|
369
|
+
# The bare <tt>=></tt> pattern will raise a NoMatchingPatternError on failure, which would
|
370
|
+
# normally be counted as a test error. This assertion rescues NoMatchingPatternError and
|
371
|
+
# generates a test failure. Any other exception will be raised as normal and generate a test
|
372
|
+
# error.
|
373
|
+
|
374
|
+
def assert_pattern
|
375
|
+
raise NotImplementedError, "only available in Ruby 3.0+" unless RUBY_VERSION >= "3.0"
|
376
|
+
flunk "assert_pattern requires a block to capture errors." unless block_given?
|
377
|
+
|
378
|
+
begin # TODO: remove after ruby 2.6 dropped
|
379
|
+
yield
|
380
|
+
pass
|
381
|
+
rescue NoMatchingPatternError => e
|
382
|
+
flunk e.message
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
360
386
|
##
|
361
387
|
# For testing with predicates. Eg:
|
362
388
|
#
|
@@ -721,6 +747,30 @@ module Minitest
|
|
721
747
|
refute obj.nil?, msg
|
722
748
|
end
|
723
749
|
|
750
|
+
##
|
751
|
+
# For testing with pattern matching (only supported with Ruby 3.0 and later)
|
752
|
+
#
|
753
|
+
# # pass
|
754
|
+
# refute_pattern { [1,2,3] => [String] }
|
755
|
+
#
|
756
|
+
# # fail "NoMatchingPatternError expected, but nothing was raised."
|
757
|
+
# refute_pattern { [1,2,3] => [Integer, Integer, Integer] }
|
758
|
+
#
|
759
|
+
# This assertion expects a NoMatchingPatternError exception, and will fail if none is raised. Any
|
760
|
+
# other exceptions will be raised as normal and generate a test error.
|
761
|
+
|
762
|
+
def refute_pattern
|
763
|
+
raise NotImplementedError, "only available in Ruby 3.0+" unless RUBY_VERSION >= "3.0"
|
764
|
+
flunk "refute_pattern requires a block to capture errors." unless block_given?
|
765
|
+
|
766
|
+
begin
|
767
|
+
yield
|
768
|
+
flunk("NoMatchingPatternError expected, but nothing was raised.")
|
769
|
+
rescue NoMatchingPatternError
|
770
|
+
pass
|
771
|
+
end
|
772
|
+
end
|
773
|
+
|
724
774
|
##
|
725
775
|
# Fails if +o1+ is not +op+ +o2+. Eg:
|
726
776
|
#
|
@@ -124,6 +124,15 @@ module Minitest::Expectations
|
|
124
124
|
|
125
125
|
infect_an_assertion :assert_output, :must_output, :block
|
126
126
|
|
127
|
+
##
|
128
|
+
# See Minitest::Assertions#assert_pattern_match
|
129
|
+
#
|
130
|
+
# _ { ... }.must_pattern_match [...]
|
131
|
+
#
|
132
|
+
# :method: must_pattern_match
|
133
|
+
|
134
|
+
infect_an_assertion :assert_pattern, :must_pattern_match, :block
|
135
|
+
|
127
136
|
##
|
128
137
|
# See Minitest::Assertions#assert_raises
|
129
138
|
#
|
@@ -283,6 +292,15 @@ module Minitest::Expectations
|
|
283
292
|
|
284
293
|
infect_an_assertion :refute_operator, :wont_be, :reverse
|
285
294
|
|
295
|
+
##
|
296
|
+
# See Minitest::Assertions#refute_pattern_match
|
297
|
+
#
|
298
|
+
# _ { ... }.wont_pattern_match [...]
|
299
|
+
#
|
300
|
+
# :method: wont_pattern_match
|
301
|
+
|
302
|
+
infect_an_assertion :refute_pattern, :wont_pattern_match, :block
|
303
|
+
|
286
304
|
##
|
287
305
|
# See Minitest::Assertions#refute_respond_to
|
288
306
|
#
|
data/lib/minitest/mock.rb
CHANGED
@@ -55,7 +55,7 @@ module Minitest # :nodoc:
|
|
55
55
|
|
56
56
|
##
|
57
57
|
# Expect that method +name+ is called, optionally with +args+ (and
|
58
|
-
# +kwargs+ or a +blk
|
58
|
+
# +kwargs+ or a +blk+), and returns +retval+.
|
59
59
|
#
|
60
60
|
# @mock.expect(:meaning_of_life, 42)
|
61
61
|
# @mock.meaning_of_life # => 42
|
data/lib/minitest/test.rb
CHANGED
@@ -80,14 +80,6 @@ module Minitest
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
##
|
84
|
-
# Defines the order to run tests (:random by default). Override
|
85
|
-
# this or use a convenience method to change it for your tests.
|
86
|
-
|
87
|
-
def self.test_order
|
88
|
-
:random
|
89
|
-
end
|
90
|
-
|
91
83
|
##
|
92
84
|
# Runs a single test with setup/teardown hooks.
|
93
85
|
|
@@ -149,7 +141,7 @@ module Minitest
|
|
149
141
|
# end
|
150
142
|
# end
|
151
143
|
#
|
152
|
-
# class
|
144
|
+
# class Minitest::Test
|
153
145
|
# include MyMinitestPlugin
|
154
146
|
# end
|
155
147
|
|
@@ -253,4 +245,4 @@ module Minitest
|
|
253
245
|
end # Test
|
254
246
|
end
|
255
247
|
|
256
|
-
require "minitest/unit"
|
248
|
+
require "minitest/unit" if ENV["MT_COMPAT"] # compatibility layer only
|
data/lib/minitest/test_task.rb
CHANGED
@@ -29,6 +29,10 @@ module Minitest # :nodoc:
|
|
29
29
|
# end
|
30
30
|
#
|
31
31
|
# Customize the name and only run unit tests.
|
32
|
+
#
|
33
|
+
# NOTE: To hook this task up to the default, make it a dependency:
|
34
|
+
#
|
35
|
+
# task default: :unit
|
32
36
|
|
33
37
|
class TestTask < Rake::TaskLib
|
34
38
|
WINDOWS = RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ # :nodoc:
|
@@ -157,8 +161,6 @@ module Minitest # :nodoc:
|
|
157
161
|
end
|
158
162
|
|
159
163
|
def define # :nodoc:
|
160
|
-
default_tasks = []
|
161
|
-
|
162
164
|
desc "Run the test suite. Use N, X, A, and TESTOPTS to add flags/args."
|
163
165
|
task name do
|
164
166
|
ruby make_test_cmd, verbose:verbose
|
@@ -243,11 +245,6 @@ module Minitest # :nodoc:
|
|
243
245
|
"sort -n -k2 -t=",
|
244
246
|
"tail -25"].join " | "
|
245
247
|
end
|
246
|
-
|
247
|
-
default_tasks << name
|
248
|
-
|
249
|
-
desc "Run the default task(s)."
|
250
|
-
task :default => default_tasks
|
251
248
|
end
|
252
249
|
|
253
250
|
##
|
data/lib/minitest.rb
CHANGED
@@ -9,7 +9,7 @@ require "etc"
|
|
9
9
|
# :include: README.rdoc
|
10
10
|
|
11
11
|
module Minitest
|
12
|
-
VERSION = "5.
|
12
|
+
VERSION = "5.19.0" # :nodoc:
|
13
13
|
|
14
14
|
@@installed_at_exit ||= false
|
15
15
|
@@after_run = []
|
@@ -32,7 +32,7 @@ module Minitest
|
|
32
32
|
|
33
33
|
cattr_accessor :parallel_executor
|
34
34
|
|
35
|
-
warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"]
|
35
|
+
warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"] && ENV["N"].to_i > 0
|
36
36
|
n_threads = (ENV["MT_CPU"] || ENV["N"] || Etc.nprocessors).to_i
|
37
37
|
|
38
38
|
self.parallel_executor = Parallel::Executor.new n_threads
|
@@ -331,19 +331,25 @@ module Minitest
|
|
331
331
|
# reporter to record.
|
332
332
|
|
333
333
|
def self.run reporter, options = {}
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
334
|
+
filtered_methods = if options[:filter]
|
335
|
+
filter = options[:filter]
|
336
|
+
filter = Regexp.new $1 if filter.is_a?(String) && filter =~ %r%/(.*)/%
|
337
|
+
|
338
|
+
self.runnable_methods.find_all { |m|
|
339
|
+
filter === m || filter === "#{self}##{m}"
|
340
|
+
}
|
341
|
+
else
|
342
|
+
self.runnable_methods
|
343
|
+
end
|
340
344
|
|
341
|
-
|
342
|
-
|
345
|
+
if options[:exclude]
|
346
|
+
exclude = options[:exclude]
|
347
|
+
exclude = Regexp.new $1 if exclude =~ %r%/(.*)/%
|
343
348
|
|
344
|
-
|
345
|
-
|
346
|
-
|
349
|
+
filtered_methods.delete_if { |m|
|
350
|
+
exclude === m || exclude === "#{self}##{m}"
|
351
|
+
}
|
352
|
+
end
|
347
353
|
|
348
354
|
return if filtered_methods.empty?
|
349
355
|
|
@@ -365,6 +371,14 @@ module Minitest
|
|
365
371
|
reporter.record Minitest.run_one_method(klass, method_name)
|
366
372
|
end
|
367
373
|
|
374
|
+
##
|
375
|
+
# Defines the order to run tests (:random by default). Override
|
376
|
+
# this or use a convenience method to change it for your tests.
|
377
|
+
|
378
|
+
def self.test_order
|
379
|
+
:random
|
380
|
+
end
|
381
|
+
|
368
382
|
def self.with_info_handler reporter, &block # :nodoc:
|
369
383
|
handler = lambda do
|
370
384
|
unless reporter.passed? then
|
@@ -432,6 +446,31 @@ module Minitest
|
|
432
446
|
self.name = name
|
433
447
|
self.failures = []
|
434
448
|
self.assertions = 0
|
449
|
+
# lazy initializer for metadata
|
450
|
+
end
|
451
|
+
|
452
|
+
##
|
453
|
+
# Metadata you attach to the test results that get sent to the reporter.
|
454
|
+
#
|
455
|
+
# Lazily initializes to a hash, to keep memory down.
|
456
|
+
#
|
457
|
+
# NOTE: this data *must* be plain (read: marshal-able) data!
|
458
|
+
# Hashes! Arrays! Strings!
|
459
|
+
|
460
|
+
def metadata
|
461
|
+
@metadata ||= {}
|
462
|
+
end
|
463
|
+
|
464
|
+
##
|
465
|
+
# Sets metadata, mainly used for +Result.from+.
|
466
|
+
|
467
|
+
attr_writer :metadata
|
468
|
+
|
469
|
+
##
|
470
|
+
# Returns true if metadata exists.
|
471
|
+
|
472
|
+
def metadata?
|
473
|
+
defined? @metadata
|
435
474
|
end
|
436
475
|
|
437
476
|
##
|
@@ -552,6 +591,7 @@ module Minitest
|
|
552
591
|
r.assertions = o.assertions
|
553
592
|
r.failures = o.failures.dup
|
554
593
|
r.time = o.time
|
594
|
+
r.metadata = o.metadata if o.metadata?
|
555
595
|
|
556
596
|
r.source_location = o.method(o.name).source_location rescue ["unknown", -1]
|
557
597
|
|
@@ -1062,6 +1062,66 @@ class TestMinitestAssertions < Minitest::Test
|
|
1062
1062
|
end
|
1063
1063
|
end
|
1064
1064
|
|
1065
|
+
def test_assert_pattern
|
1066
|
+
if RUBY_VERSION > "3" then
|
1067
|
+
@tc.assert_pattern do
|
1068
|
+
exp = if RUBY_VERSION.start_with? "3.0"
|
1069
|
+
"(eval):1: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!\n"
|
1070
|
+
else
|
1071
|
+
""
|
1072
|
+
end
|
1073
|
+
assert_output nil, exp do
|
1074
|
+
eval "[1,2,3] => [Integer, Integer, Integer]" # eval to escape parser for ruby<3
|
1075
|
+
end
|
1076
|
+
end
|
1077
|
+
else
|
1078
|
+
@assertion_count = 0
|
1079
|
+
|
1080
|
+
assert_raises NotImplementedError do
|
1081
|
+
@tc.assert_pattern do
|
1082
|
+
# do nothing
|
1083
|
+
end
|
1084
|
+
end
|
1085
|
+
end
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
def test_assert_pattern_traps_nomatchingpatternerror
|
1089
|
+
skip unless RUBY_VERSION > "3"
|
1090
|
+
exp = if RUBY_VERSION.start_with? "3.0" then
|
1091
|
+
"[1, 2, 3]" # terrible error message!
|
1092
|
+
else
|
1093
|
+
/length mismatch/
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
assert_triggered exp do
|
1097
|
+
@tc.assert_pattern do
|
1098
|
+
capture_io do # 3.0 is noisy
|
1099
|
+
eval "[1,2,3] => [Integer, Integer]" # eval to escape parser for ruby<3
|
1100
|
+
end
|
1101
|
+
end
|
1102
|
+
end
|
1103
|
+
end
|
1104
|
+
|
1105
|
+
def test_assert_pattern_raises_other_exceptions
|
1106
|
+
skip unless RUBY_VERSION >= "3.0"
|
1107
|
+
|
1108
|
+
@assertion_count = 0
|
1109
|
+
|
1110
|
+
assert_raises RuntimeError do
|
1111
|
+
@tc.assert_pattern do
|
1112
|
+
raise "boom"
|
1113
|
+
end
|
1114
|
+
end
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
def test_assert_pattern_with_no_block
|
1118
|
+
skip unless RUBY_VERSION >= "3.0"
|
1119
|
+
|
1120
|
+
assert_triggered "assert_pattern requires a block to capture errors." do
|
1121
|
+
@tc.assert_pattern
|
1122
|
+
end
|
1123
|
+
end
|
1124
|
+
|
1065
1125
|
def test_capture_io
|
1066
1126
|
@assertion_count = 0
|
1067
1127
|
|
@@ -1314,6 +1374,56 @@ class TestMinitestAssertions < Minitest::Test
|
|
1314
1374
|
end
|
1315
1375
|
end
|
1316
1376
|
|
1377
|
+
def test_refute_pattern
|
1378
|
+
if RUBY_VERSION >= "3.0"
|
1379
|
+
@tc.refute_pattern do
|
1380
|
+
capture_io do # 3.0 is noisy
|
1381
|
+
eval "[1,2,3] => [Integer, Integer, String]"
|
1382
|
+
end
|
1383
|
+
end
|
1384
|
+
else
|
1385
|
+
@assertion_count = 0
|
1386
|
+
|
1387
|
+
assert_raises NotImplementedError do
|
1388
|
+
@tc.refute_pattern do
|
1389
|
+
eval "[1,2,3] => [Integer, Integer, String]"
|
1390
|
+
end
|
1391
|
+
end
|
1392
|
+
end
|
1393
|
+
end
|
1394
|
+
|
1395
|
+
def test_refute_pattern_expects_nomatchingpatternerror
|
1396
|
+
skip unless RUBY_VERSION > "3"
|
1397
|
+
|
1398
|
+
assert_triggered(/NoMatchingPatternError expected, but nothing was raised./) do
|
1399
|
+
@tc.refute_pattern do
|
1400
|
+
capture_io do # 3.0 is noisy
|
1401
|
+
eval "[1,2,3] => [Integer, Integer, Integer]"
|
1402
|
+
end
|
1403
|
+
end
|
1404
|
+
end
|
1405
|
+
end
|
1406
|
+
|
1407
|
+
def test_refute_pattern_raises_other_exceptions
|
1408
|
+
skip unless RUBY_VERSION >= "3.0"
|
1409
|
+
|
1410
|
+
@assertion_count = 0
|
1411
|
+
|
1412
|
+
assert_raises RuntimeError do
|
1413
|
+
@tc.refute_pattern do
|
1414
|
+
raise "boom"
|
1415
|
+
end
|
1416
|
+
end
|
1417
|
+
end
|
1418
|
+
|
1419
|
+
def test_refute_pattern_with_no_block
|
1420
|
+
skip unless RUBY_VERSION >= "3.0"
|
1421
|
+
|
1422
|
+
assert_triggered "refute_pattern requires a block to capture errors." do
|
1423
|
+
@tc.refute_pattern
|
1424
|
+
end
|
1425
|
+
end
|
1426
|
+
|
1317
1427
|
def test_refute_predicate
|
1318
1428
|
@tc.refute_predicate "42", :empty?
|
1319
1429
|
end
|
@@ -65,6 +65,12 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
65
65
|
@pt ||= Minitest::Result.from Minitest::Test.new(:woot)
|
66
66
|
end
|
67
67
|
|
68
|
+
def passing_test_with_metadata
|
69
|
+
test = Minitest::Test.new(:woot)
|
70
|
+
test.metadata[:meta] = :data
|
71
|
+
@pt ||= Minitest::Result.from test
|
72
|
+
end
|
73
|
+
|
68
74
|
def skip_test
|
69
75
|
unless defined? @st then
|
70
76
|
@st = Minitest::Test.new(:woot)
|
@@ -166,6 +172,29 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
166
172
|
assert_equal 0, r.assertions
|
167
173
|
end
|
168
174
|
|
175
|
+
def test_record_pass_with_metadata
|
176
|
+
reporter = self.r
|
177
|
+
|
178
|
+
def reporter.metadata
|
179
|
+
@metadata
|
180
|
+
end
|
181
|
+
|
182
|
+
def reporter.record result
|
183
|
+
super
|
184
|
+
@metadata = result.metadata if result.metadata?
|
185
|
+
end
|
186
|
+
|
187
|
+
r.record passing_test_with_metadata
|
188
|
+
|
189
|
+
exp = { :meta => :data }
|
190
|
+
assert_equal exp, reporter.metadata
|
191
|
+
|
192
|
+
assert_equal ".", io.string
|
193
|
+
assert_empty r.results
|
194
|
+
assert_equal 1, r.count
|
195
|
+
assert_equal 0, r.assertions
|
196
|
+
end
|
197
|
+
|
169
198
|
def test_record_fail
|
170
199
|
fail_test = self.fail_test
|
171
200
|
r.record fail_test
|
@@ -137,6 +137,46 @@ describe Minitest::Spec do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
+
def good_pattern
|
141
|
+
capture_io do # 3.0 is noisy
|
142
|
+
eval "[1,2,3] => [Integer, Integer, Integer]" # eval to escape parser for ruby<3
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def bad_pattern
|
147
|
+
capture_io do # 3.0 is noisy
|
148
|
+
eval "[1,2,3] => [Integer, Integer]" # eval to escape parser for ruby<3
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
it "needs to pattern match" do
|
153
|
+
@assertion_count = 1
|
154
|
+
|
155
|
+
if RUBY_VERSION > "3" then
|
156
|
+
expect { good_pattern }.must_pattern_match
|
157
|
+
else
|
158
|
+
assert_raises NotImplementedError do
|
159
|
+
expect {}.must_pattern_match
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
it "needs to error on bad pattern match" do
|
165
|
+
skip unless RUBY_VERSION > "3"
|
166
|
+
|
167
|
+
@assertion_count = 1
|
168
|
+
|
169
|
+
exp = if RUBY_VERSION.start_with? "3.0"
|
170
|
+
"[1, 2, 3]" # terrible error message!
|
171
|
+
else
|
172
|
+
/length mismatch/
|
173
|
+
end
|
174
|
+
|
175
|
+
assert_triggered exp do
|
176
|
+
expect { bad_pattern }.must_pattern_match
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
140
180
|
it "needs to ensure silence" do
|
141
181
|
@assertion_count -= 1 # no msg
|
142
182
|
@assertion_count += 2 # assert_output is 2 assertions
|
@@ -172,6 +212,7 @@ describe Minitest::Spec do
|
|
172
212
|
must_include
|
173
213
|
must_match
|
174
214
|
must_output
|
215
|
+
must_pattern_match
|
175
216
|
must_raise
|
176
217
|
must_respond_to
|
177
218
|
must_throw
|
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.
|
4
|
+
version: 5.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
ROfWo9Uyp8ba/j9eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
|
30
30
|
nsNBRuQJ1UfiCG97a6DNm+Fr
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2023-
|
32
|
+
date: 2023-07-26 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
@@ -157,12 +157,12 @@ files:
|
|
157
157
|
- test/minitest/test_minitest_spec.rb
|
158
158
|
- test/minitest/test_minitest_test.rb
|
159
159
|
- test/minitest/test_minitest_test_task.rb
|
160
|
-
homepage: https://github.com/
|
160
|
+
homepage: https://github.com/minitest/minitest
|
161
161
|
licenses:
|
162
162
|
- MIT
|
163
163
|
metadata:
|
164
|
-
homepage_uri: https://github.com/
|
165
|
-
bug_tracker_uri: https://github.com/
|
164
|
+
homepage_uri: https://github.com/minitest/minitest
|
165
|
+
bug_tracker_uri: https://github.com/minitest/minitest/issues
|
166
166
|
post_install_message:
|
167
167
|
rdoc_options:
|
168
168
|
- "--main"
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
- !ruby/object:Gem::Version
|
184
184
|
version: '0'
|
185
185
|
requirements: []
|
186
|
-
rubygems_version: 3.
|
186
|
+
rubygems_version: 3.4.10
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: minitest provides a complete suite of testing facilities supporting TDD,
|
metadata.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
��o*[*��m�ݡ�^o3�w�S���o/��5��RO �˯'��~RϖXl��?w���Al��ƀ���� *��;�-ϯӛ�Si�Č�P=��d������0n0?"D�b�W�N�m��pk!�^�j�����X�]"���Ho��$�qe�7�:�=��T̿tEZ�6�[Yh5�Dq�4�RDt;D�� I
|
1
|
+
e�*E�0�z�7�D�z�<��+���'�B@lO"S<r�#��204�Q�1�Ն�l�FS-%]�0�Q�_}�BB3�-�Ne"�UP���[�G�u�N��>�K����#�5d��"2)$��3m���F��(���@�>�k���"ZRͮ`�-�&|N��y�t92z������c�ffz�.�O����%���r��YJ����<E��㲌�R>�'-~'�4q���%oď�����0f@�fu�ϳ���$�9�
|