minitest 6.0.2 → 6.0.6
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +26 -0
- data/lib/minitest/assertions.rb +13 -10
- data/lib/minitest/server_plugin.rb +1 -1
- data/lib/minitest.rb +1 -1
- data/test/minitest/test_minitest_assertions.rb +66 -0
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5bd5f764a0e5823b6af414ce7869ad229d5f417e901796475965dc869f81b0c3
|
|
4
|
+
data.tar.gz: b82a599afbc0ea6d9e4fe022fdf2fb20f81d875d012c57dd0db9cc7bf2a15acc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da7ef69a9a580f646ec8071574af269cc3c6a31055d2fbb5eecd6b4ba332338c91ad09469f85982b6882354e67fe82845636671bc8fd2cabe85db97497391d18
|
|
7
|
+
data.tar.gz: 05bad64ac6aa587be47737759231213c1ae86f2d7b78837392a6efddc3e7559b7f293a9d38056ed8dbcff868d601c2c6c2fea673a185da30d50d2c5193e164f7
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/History.rdoc
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
=== 6.0.6 / 2026-04-30
|
|
2
|
+
|
|
3
|
+
* 2 bug fixes:
|
|
4
|
+
|
|
5
|
+
* Fix using assert_equal/same/nil w/ BasicObject by comparing w/ `nil == exp`. (mtasaka)
|
|
6
|
+
* Removed private Assertions#_where as it is no longer used.
|
|
7
|
+
|
|
8
|
+
=== 6.0.5 / 2026-04-20
|
|
9
|
+
|
|
10
|
+
* 2 bug fixes:
|
|
11
|
+
|
|
12
|
+
* Avoid circular requires in lib/minitest/server_plugin.rb.
|
|
13
|
+
* Raise TypeError if assert_raises is passed anything but modules/classes.
|
|
14
|
+
|
|
15
|
+
=== 6.0.4 / 2026-04-14
|
|
16
|
+
|
|
17
|
+
* 1 bug fix:
|
|
18
|
+
|
|
19
|
+
* Fixed refute_predicate to call assert_respond_to w/ include_all:true like assert_predicate does. (jparker)
|
|
20
|
+
|
|
21
|
+
=== 6.0.3 / 2026-03-31
|
|
22
|
+
|
|
23
|
+
* 1 bug fix:
|
|
24
|
+
|
|
25
|
+
* assert_same(nil, value) no longer allowed. Use assert_nil to be explicit. (paddor)
|
|
26
|
+
|
|
1
27
|
=== 6.0.2 / 2026-02-23
|
|
2
28
|
|
|
3
29
|
* 7 bug fixes:
|
data/lib/minitest/assertions.rb
CHANGED
|
@@ -190,11 +190,6 @@ module Minitest
|
|
|
190
190
|
assert_predicate obj, :empty?, msg
|
|
191
191
|
end
|
|
192
192
|
|
|
193
|
-
def _where # :nodoc:
|
|
194
|
-
Minitest.filter_backtrace(caller).first
|
|
195
|
-
.split(":in ", 2).first # clean up noise
|
|
196
|
-
end
|
|
197
|
-
|
|
198
193
|
##
|
|
199
194
|
# Fails unless <tt>exp == act</tt> printing the difference between
|
|
200
195
|
# the two, if possible.
|
|
@@ -211,7 +206,7 @@ module Minitest
|
|
|
211
206
|
def assert_equal exp, act, msg = nil
|
|
212
207
|
msg = message(msg, nil) { diff exp, act }
|
|
213
208
|
|
|
214
|
-
refute_nil exp, message { "Use assert_nil if expecting nil" } if
|
|
209
|
+
refute_nil exp, message { "Use assert_nil if expecting nil" } if nil == exp # don't count
|
|
215
210
|
|
|
216
211
|
assert exp == act, msg
|
|
217
212
|
end
|
|
@@ -287,7 +282,7 @@ module Minitest
|
|
|
287
282
|
|
|
288
283
|
def assert_nil obj, msg = nil
|
|
289
284
|
msg = message(msg) { "Expected #{mu_pp obj} to be nil" }
|
|
290
|
-
assert
|
|
285
|
+
assert nil == obj, msg
|
|
291
286
|
end
|
|
292
287
|
|
|
293
288
|
##
|
|
@@ -381,6 +376,8 @@ module Minitest
|
|
|
381
376
|
assert o1.__send__(op), msg
|
|
382
377
|
end
|
|
383
378
|
|
|
379
|
+
NO_RE_MSG = "class or module required for rescue clause. Got %p"
|
|
380
|
+
|
|
384
381
|
##
|
|
385
382
|
# Fails unless the block raises one of +exp+. Returns the
|
|
386
383
|
# exception matched so you can check the message, attributes, etc.
|
|
@@ -410,6 +407,9 @@ module Minitest
|
|
|
410
407
|
msg = "#{exp.pop}.\n" if String === exp.last
|
|
411
408
|
exp << StandardError if exp.empty?
|
|
412
409
|
|
|
410
|
+
# TODO: remove this if https://bugs.ruby-lang.org/issues/22007 gets fixed
|
|
411
|
+
raise TypeError, NO_RE_MSG % [exp] unless exp.all? Module
|
|
412
|
+
|
|
413
413
|
begin
|
|
414
414
|
yield
|
|
415
415
|
rescue *exp => e
|
|
@@ -448,6 +448,9 @@ module Minitest
|
|
|
448
448
|
data = [mu_pp(act), act.object_id, mu_pp(exp), exp.object_id]
|
|
449
449
|
"Expected %s (oid=%d) to be the same as %s (oid=%d)" % data
|
|
450
450
|
}
|
|
451
|
+
|
|
452
|
+
refute_nil exp, message { "Use assert_nil if expecting nil" } if nil == exp # don't count
|
|
453
|
+
|
|
451
454
|
assert exp.equal?(act), msg
|
|
452
455
|
end
|
|
453
456
|
|
|
@@ -603,7 +606,7 @@ module Minitest
|
|
|
603
606
|
def message msg = nil, ending = ".", &default
|
|
604
607
|
return msg if Proc === msg
|
|
605
608
|
proc {
|
|
606
|
-
custom_message = "#{msg}.\n" unless
|
|
609
|
+
custom_message = "#{msg}.\n" unless nil == msg or msg.to_s.empty?
|
|
607
610
|
"#{custom_message}#{default.call}#{ending}"
|
|
608
611
|
}
|
|
609
612
|
end
|
|
@@ -704,7 +707,7 @@ module Minitest
|
|
|
704
707
|
|
|
705
708
|
def refute_nil obj, msg = nil
|
|
706
709
|
msg = message(msg) { "Expected #{mu_pp obj} to not be nil" }
|
|
707
|
-
refute
|
|
710
|
+
refute nil == obj, msg
|
|
708
711
|
end
|
|
709
712
|
|
|
710
713
|
##
|
|
@@ -759,7 +762,7 @@ module Minitest
|
|
|
759
762
|
# str.wont_be :empty?
|
|
760
763
|
|
|
761
764
|
def refute_predicate o1, op, msg = nil
|
|
762
|
-
assert_respond_to o1, op
|
|
765
|
+
assert_respond_to o1, op, include_all:true
|
|
763
766
|
msg = message(msg) { "Expected #{mu_pp o1} to not be #{op}" }
|
|
764
767
|
refute o1.__send__(op), msg
|
|
765
768
|
end
|
data/lib/minitest.rb
CHANGED
|
@@ -810,6 +810,66 @@ class TestMinitestAssertions < Minitest::Test
|
|
|
810
810
|
end
|
|
811
811
|
end
|
|
812
812
|
|
|
813
|
+
def test_assert_raises__string_msg
|
|
814
|
+
e = assert_raises Minitest::Assertion do
|
|
815
|
+
@tc.assert_raises RuntimeError, "assertion message" do
|
|
816
|
+
raise SomeError, "blah"
|
|
817
|
+
end
|
|
818
|
+
end
|
|
819
|
+
|
|
820
|
+
expected = <<~EOM.chomp
|
|
821
|
+
assertion message.
|
|
822
|
+
[RuntimeError] exception expected, not
|
|
823
|
+
Class: <SomeError>
|
|
824
|
+
Message: <"blah">
|
|
825
|
+
---Backtrace---
|
|
826
|
+
FILE:LINE:in 'block in test_assert_raises__string_msg'
|
|
827
|
+
---------------
|
|
828
|
+
EOM
|
|
829
|
+
|
|
830
|
+
actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
|
|
831
|
+
actual.gsub! RE_LEVELS, "" unless jruby?
|
|
832
|
+
actual.gsub!(/[`']block in (?:TestMinitestAssertions#)?/, "'block in ")
|
|
833
|
+
|
|
834
|
+
assert_equal expected, actual
|
|
835
|
+
end
|
|
836
|
+
|
|
837
|
+
def test_assert_raises__regexp_err
|
|
838
|
+
@assertion_count = 0
|
|
839
|
+
|
|
840
|
+
e = assert_raises TypeError do
|
|
841
|
+
@tc.assert_raises RuntimeError, %r%does not work%, "assertion message" do
|
|
842
|
+
raise SomeError, "blah"
|
|
843
|
+
end
|
|
844
|
+
end
|
|
845
|
+
|
|
846
|
+
expected = <<~EOM.chomp
|
|
847
|
+
class or module required for rescue clause. Got [RuntimeError, /does not work/]
|
|
848
|
+
EOM
|
|
849
|
+
|
|
850
|
+
actual = e.message
|
|
851
|
+
|
|
852
|
+
assert_equal expected, actual
|
|
853
|
+
end
|
|
854
|
+
|
|
855
|
+
def test_assert_raises__regexp_err_default
|
|
856
|
+
@assertion_count = 0
|
|
857
|
+
|
|
858
|
+
e = assert_raises TypeError do
|
|
859
|
+
@tc.assert_raises %r%does not work% do
|
|
860
|
+
raise "blah"
|
|
861
|
+
end
|
|
862
|
+
end
|
|
863
|
+
|
|
864
|
+
expected = <<~EOM.chomp
|
|
865
|
+
class or module required for rescue clause. Got [/does not work/]
|
|
866
|
+
EOM
|
|
867
|
+
|
|
868
|
+
actual = e.message
|
|
869
|
+
|
|
870
|
+
assert_equal expected, actual
|
|
871
|
+
end
|
|
872
|
+
|
|
813
873
|
def test_assert_raises_subclass
|
|
814
874
|
@tc.assert_raises StandardError do
|
|
815
875
|
raise AnError
|
|
@@ -960,6 +1020,12 @@ class TestMinitestAssertions < Minitest::Test
|
|
|
960
1020
|
end
|
|
961
1021
|
end
|
|
962
1022
|
|
|
1023
|
+
def test_assert_same__does_not_allow_lhs_nil
|
|
1024
|
+
assert_triggered(/Use assert_nil if expecting nil/) do
|
|
1025
|
+
@tc.assert_same nil, nil
|
|
1026
|
+
end
|
|
1027
|
+
end
|
|
1028
|
+
|
|
963
1029
|
def test_assert_silent
|
|
964
1030
|
@assertion_count = 2
|
|
965
1031
|
|
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: 6.0.
|
|
4
|
+
version: 6.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Davis
|
|
@@ -98,14 +98,14 @@ dependencies:
|
|
|
98
98
|
requirements:
|
|
99
99
|
- - "~>"
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '4.
|
|
101
|
+
version: '4.7'
|
|
102
102
|
type: :development
|
|
103
103
|
prerelease: false
|
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements:
|
|
106
106
|
- - "~>"
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: '4.
|
|
108
|
+
version: '4.7'
|
|
109
109
|
description: |-
|
|
110
110
|
minitest provides a complete suite of testing facilities supporting
|
|
111
111
|
TDD, BDD, and benchmarking.
|
metadata.gz.sig
CHANGED
|
Binary file
|