minitest 6.0.4 → 6.0.5
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 +1 -2
- data/lib/minitest/assertions.rb +5 -0
- data/lib/minitest/server_plugin.rb +1 -1
- data/test/minitest/test_minitest_assertions.rb +60 -0
- data.tar.gz.sig +2 -4
- metadata +1 -1
- 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: 3cef62fc91f5ae9128c4ae7c9b91645b26776921ae38e8cfdec016ebcf211055
|
|
4
|
+
data.tar.gz: 0e690cc45bba5de6d08add5fd0ba898e7b0eaa9dc48ce4f4e8b2042e5989e921
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92c632765b48431ea163a93dc4ae80440c38c6964cbbfccba861e32ab4f7530ed5651d6d3adcbfa45f126eaad9df7b09b3744229c05de529ff76770965b1c871
|
|
7
|
+
data.tar.gz: 8598ca82c49794072035669c2cc8e9b586c18187d08d1ab53c1d503c09bfdadf58af05f70c02437a6e93df4dc14050b59ff16cf020641ca7684dadd900eaa3ad
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
��Wk��a d{����R"��*��Sg�;�"8Y��]��nvp��{Y[��(��\�r�>�K;i�f���?$Tt�S�歐d��O��
|
|
1
|
+
N�����u�(h�o/��>�?Dž���$7]�h�Y\�y�7Jj�-leaܗk=\�+2���5���Ar� ��rg�k�^�EB��rW.hc�T���|<�F���5��5����P+i9�F�0HCH�CBcns�;��=
|
data/lib/minitest/assertions.rb
CHANGED
|
@@ -381,6 +381,8 @@ module Minitest
|
|
|
381
381
|
assert o1.__send__(op), msg
|
|
382
382
|
end
|
|
383
383
|
|
|
384
|
+
NO_RE_MSG = "class or module required for rescue clause. Got %p"
|
|
385
|
+
|
|
384
386
|
##
|
|
385
387
|
# Fails unless the block raises one of +exp+. Returns the
|
|
386
388
|
# exception matched so you can check the message, attributes, etc.
|
|
@@ -410,6 +412,9 @@ module Minitest
|
|
|
410
412
|
msg = "#{exp.pop}.\n" if String === exp.last
|
|
411
413
|
exp << StandardError if exp.empty?
|
|
412
414
|
|
|
415
|
+
# TODO: remove this if https://bugs.ruby-lang.org/issues/22007 gets fixed
|
|
416
|
+
raise TypeError, NO_RE_MSG % [exp] unless exp.all? Module
|
|
417
|
+
|
|
413
418
|
begin
|
|
414
419
|
yield
|
|
415
420
|
rescue *exp => e
|
|
@@ -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
|
data.tar.gz.sig
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
��(l{�e��u�8�X7`3l������j�*���4���� c
|
|
4
|
-
�
|
|
1
|
+
)��7cn(���h˛��AK��q��SN�;R���1�nG
|
|
2
|
+
� ���`LA������J��STfn���D�5�9>�� ��i�hٚ�hx�GmI+j���F�����ac&E�m4��ja^�P�ƾ�N��t��-��o��V��zf����;8lـA�=A�n��ܜ}��[��[��%�Qk�3}�#o�Jăæ�,�qa`�5w��UP;[Q٪�7��|KZM�k�8�P�dM
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|