mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
More fixed assertion message tests
This commit is contained in:
parent
1c4f0f1eee
commit
bc1c09c6e8
Notes:
git
2021-09-11 08:48:30 +09:00
1 changed files with 10 additions and 17 deletions
|
@ -504,9 +504,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
def test_assert_equal_different_collection_array_hex_invisible
|
def test_assert_equal_different_collection_array_hex_invisible
|
||||||
object1 = Object.new
|
object1 = Object.new
|
||||||
object2 = Object.new
|
object2 = Object.new
|
||||||
msg = "No visible difference in the Array#inspect output.
|
msg = "<[#{object1.inspect}]> expected but was
|
||||||
You should look at the implementation of #== on Array or its members.
|
<[#{object2.inspect}]>.".gsub(/^ +/, "")
|
||||||
[#<Object:0xXXXXXX>]".gsub(/^ +/, "")
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
@tc.assert_equal [object1], [object2]
|
@tc.assert_equal [object1], [object2]
|
||||||
end
|
end
|
||||||
|
@ -516,9 +515,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
h1, h2 = {}, {}
|
h1, h2 = {}, {}
|
||||||
h1[1] = Object.new
|
h1[1] = Object.new
|
||||||
h2[1] = Object.new
|
h2[1] = Object.new
|
||||||
msg = "No visible difference in the Hash#inspect output.
|
msg = "<#{h1.inspect}> expected but was
|
||||||
You should look at the implementation of #== on Hash or its members.
|
<#{h2.inspect}>.".gsub(/^ +/, "")
|
||||||
{1=>#<Object:0xXXXXXX>}".gsub(/^ +/, "")
|
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
@tc.assert_equal h1, h2
|
@tc.assert_equal h1, h2
|
||||||
|
@ -545,12 +543,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
o1 = c.new "a"
|
o1 = c.new "a"
|
||||||
o2 = c.new "b"
|
o2 = c.new "b"
|
||||||
msg = "--- expected
|
msg = "<#{o1.inspect}> expected but was
|
||||||
+++ actual
|
<#{o2.inspect}>.".gsub(/^ +/, "")
|
||||||
@@ -1 +1 @@
|
|
||||||
-#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"a\">
|
|
||||||
+#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"b\">
|
|
||||||
".gsub(/^ +/, "")
|
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
@tc.assert_equal o1, o2
|
@tc.assert_equal o1, o2
|
||||||
|
@ -561,9 +555,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
o1 = Object.new
|
o1 = Object.new
|
||||||
o2 = Object.new
|
o2 = Object.new
|
||||||
|
|
||||||
msg = "No visible difference in the Object#inspect output.
|
msg = "<#{o1.inspect}> expected but was
|
||||||
You should look at the implementation of #== on Object or its members.
|
<#{o2.inspect}>.".gsub(/^ +/, "")
|
||||||
#<Object:0xXXXXXX>".gsub(/^ +/, "")
|
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
@tc.assert_equal o1, o2
|
@tc.assert_equal o1, o2
|
||||||
|
@ -621,14 +614,14 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_assert_equal_different_short_multiline
|
def test_assert_equal_different_short_multiline
|
||||||
msg = "--- expected\n+++ actual\n@@ -1,2 +1,2 @@\n \"a\n-b\"\n+c\"\n"
|
msg = "<\"a\\n\" + \"b\"> expected but was\n<\"a\\n\" + \"c\">."
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
@tc.assert_equal "a\nb", "a\nc"
|
@tc.assert_equal "a\nb", "a\nc"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_assert_equal_different_escaped_newline
|
def test_assert_equal_different_escaped_newline
|
||||||
msg = "--- expected\n+++ actual\n@@ -1,2 +1,2 @@\n \"xxx\n-a\\\\nb\"\n+a\\\\nc\"\n"
|
msg = "<\"xxx\\n\" + \"a\\\\nb\"> expected but was\n<\"xxx\\n\" + \"a\\\\nc\">."
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
@tc.assert_equal "xxx\na\\nb", "xxx\na\\nc"
|
@tc.assert_equal "xxx\na\\nb", "xxx\na\\nc"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue