[前][次][番号順一覧][スレッド一覧]

ruby-changes:67911

From: Hiroshi <ko1@a...>
Date: Sat, 11 Sep 2021 08:48:52 +0900 (JST)
Subject: [ruby-changes:67911] 47928204b7 (master): Fixed compatible assertion message format

https://git.ruby-lang.org/ruby.git/commit/?id=47928204b7

From 47928204b7541f7728eae4ebc157029af8c42589 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Thu, 9 Sep 2021 20:55:53 +0900
Subject: Fixed compatible assertion message format

---
 tool/test/testunit/test_minitest_unit.rb | 46 ++++++++------------------------
 1 file changed, 11 insertions(+), 35 deletions(-)

diff --git a/tool/test/testunit/test_minitest_unit.rb b/tool/test/testunit/test_minitest_unit.rb
index a88d368..9d2b086a 100644
--- a/tool/test/testunit/test_minitest_unit.rb
+++ b/tool/test/testunit/test_minitest_unit.rb
@@ -571,12 +571,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L571
   end
 
   def test_assert_equal_different_long
-    msg = "--- expected
-           +++ actual
-           @@ -1 +1 @@
-           -\"hahahahahahahahahahahahahahahahahahahaha\"
-           +\"blahblahblahblahblahblahblahblahblahblah\"
-           ".gsub(/^ +/, "")
+    msg = "<\"hahahahahahahahahahahahahahahahahahahaha\"> expected but was
+           <\"blahblahblahblahblahblahblahblahblahblah\">.".gsub(/^ +/, "")
 
     util_assert_triggered msg do
       o1 = "haha" * 10
@@ -587,9 +583,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L583
   end
 
   def test_assert_equal_different_long_invisible
-    msg = "No visible difference in the String#inspect output.
-           You should look at the implementation of #== on String or its members.
-           \"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "")
+    msg = "<\"blahblahblahblahblahblahblahblahblahblah\"> (UTF-8) expected but was
+           <\"blahblahblahblahblahblahblahblahblahblah\"> (UTF-8).".gsub(/^ +/, "")
 
     util_assert_triggered msg do
       o1 = "blah" * 10
@@ -603,12 +598,8 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L598
 
   def test_assert_equal_different_long_msg
     msg = "message.
-           --- expected
-           +++ actual
-           @@ -1 +1 @@
-           -\"hahahahahahahahahahahahahahahahahahahaha\"
-           +\"blahblahblahblahblahblahblahblahblahblah\"
-           ".gsub(/^ +/, "")
+           <\"hahahahahahahahahahahahahahahahahahahaha\"> expected but was
+           <\"blahblahblahblahblahblahblahblahblahblah\">.".gsub(/^ +/, "")
 
     util_assert_triggered msg do
       o1 = "haha" * 10
@@ -921,12 +912,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L912
     end
 
     expected = clean <<-EOM.chomp
-      [RuntimeError] exception expected, not
-      Class: <SyntaxError>
-      Message: <\"icky\">
-      ---Backtrace---
-      FILE:LINE:in \`test_assert_raise_triggered_different\'
-      ---------------
+      [RuntimeError] exception expected, not #<SyntaxError: icky>.
     EOM
 
     actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
@@ -944,12 +930,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L930
 
     expected = clean <<-EOM
       XXX.
-      [RuntimeError] exception expected, not
-      Class: <SyntaxError>
-      Message: <\"icky\">
-      ---Backtrace---
-      FILE:LINE:in \`test_assert_raise_triggered_different_msg\'
-      ---------------
+      [RuntimeError] exception expected, not #<SyntaxError: icky>.
     EOM
 
     actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
@@ -990,12 +971,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L971
     end
 
     expected = clean <<-EOM.chomp
-      [StandardError] exception expected, not
-      Class: <AnError>
-      Message: <\"AnError\">
-      ---Backtrace---
-      FILE:LINE:in \`test_assert_raise_triggered_subclass\'
-      ---------------
+      [StandardError] exception expected, not #<AnError: AnError>.
     EOM
 
     actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
@@ -1043,7 +1019,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L1019
   end
 
   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]
     end
   end
@@ -1184,7 +1160,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L1160
   end
 
   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" }
     end
   end
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]