mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
Fixed compatible assertion message format
This commit is contained in:
parent
0a5844cbdd
commit
47928204b7
Notes:
git
2021-09-11 08:48:31 +09:00
1 changed files with 11 additions and 35 deletions
|
@ -571,12 +571,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_assert_equal_different_long
|
def test_assert_equal_different_long
|
||||||
msg = "--- expected
|
msg = "<\"hahahahahahahahahahahahahahahahahahahaha\"> expected but was
|
||||||
+++ actual
|
<\"blahblahblahblahblahblahblahblahblahblah\">.".gsub(/^ +/, "")
|
||||||
@@ -1 +1 @@
|
|
||||||
-\"hahahahahahahahahahahahahahahahahahahaha\"
|
|
||||||
+\"blahblahblahblahblahblahblahblahblahblah\"
|
|
||||||
".gsub(/^ +/, "")
|
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
o1 = "haha" * 10
|
o1 = "haha" * 10
|
||||||
|
@ -587,9 +583,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_assert_equal_different_long_invisible
|
def test_assert_equal_different_long_invisible
|
||||||
msg = "No visible difference in the String#inspect output.
|
msg = "<\"blahblahblahblahblahblahblahblahblahblah\"> (UTF-8) expected but was
|
||||||
You should look at the implementation of #== on String or its members.
|
<\"blahblahblahblahblahblahblahblahblahblah\"> (UTF-8).".gsub(/^ +/, "")
|
||||||
\"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "")
|
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
o1 = "blah" * 10
|
o1 = "blah" * 10
|
||||||
|
@ -603,12 +598,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_assert_equal_different_long_msg
|
def test_assert_equal_different_long_msg
|
||||||
msg = "message.
|
msg = "message.
|
||||||
--- expected
|
<\"hahahahahahahahahahahahahahahahahahahaha\"> expected but was
|
||||||
+++ actual
|
<\"blahblahblahblahblahblahblahblahblahblah\">.".gsub(/^ +/, "")
|
||||||
@@ -1 +1 @@
|
|
||||||
-\"hahahahahahahahahahahahahahahahahahahaha\"
|
|
||||||
+\"blahblahblahblahblahblahblahblahblahblah\"
|
|
||||||
".gsub(/^ +/, "")
|
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
o1 = "haha" * 10
|
o1 = "haha" * 10
|
||||||
|
@ -921,12 +912,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
expected = clean <<-EOM.chomp
|
expected = clean <<-EOM.chomp
|
||||||
[RuntimeError] exception expected, not
|
[RuntimeError] exception expected, not #<SyntaxError: icky>.
|
||||||
Class: <SyntaxError>
|
|
||||||
Message: <\"icky\">
|
|
||||||
---Backtrace---
|
|
||||||
FILE:LINE:in \`test_assert_raise_triggered_different\'
|
|
||||||
---------------
|
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
|
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
|
||||||
|
@ -944,12 +930,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
expected = clean <<-EOM
|
expected = clean <<-EOM
|
||||||
XXX.
|
XXX.
|
||||||
[RuntimeError] exception expected, not
|
[RuntimeError] exception expected, not #<SyntaxError: icky>.
|
||||||
Class: <SyntaxError>
|
|
||||||
Message: <\"icky\">
|
|
||||||
---Backtrace---
|
|
||||||
FILE:LINE:in \`test_assert_raise_triggered_different_msg\'
|
|
||||||
---------------
|
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
|
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
|
||||||
|
@ -990,12 +971,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
expected = clean <<-EOM.chomp
|
expected = clean <<-EOM.chomp
|
||||||
[StandardError] exception expected, not
|
[StandardError] exception expected, not #<AnError: AnError>.
|
||||||
Class: <AnError>
|
|
||||||
Message: <\"AnError\">
|
|
||||||
---Backtrace---
|
|
||||||
FILE:LINE:in \`test_assert_raise_triggered_subclass\'
|
|
||||||
---------------
|
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
|
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
|
||||||
|
@ -1043,7 +1019,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_assert_send_bad
|
def test_assert_send_bad
|
||||||
util_assert_triggered "Expected 1.>(*[2]) to return true." do
|
util_assert_triggered "Expected 1.>(2) to return true." do
|
||||||
@tc.assert_send [1, :>, 2]
|
@tc.assert_send [1, :>, 2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1184,7 +1160,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_message_lambda
|
def test_message_lambda
|
||||||
util_assert_triggered "whoops.\nExpected: 1\n Actual: 2" do
|
util_assert_triggered "whoops.\n<1> expected but was\n<2>." do
|
||||||
@tc.assert_equal 1, 2, lambda { "whoops" }
|
@tc.assert_equal 1, 2, lambda { "whoops" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue