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

ruby-changes:34507

From: nobu <ko1@a...>
Date: Sat, 28 Jun 2014 00:44:27 +0900 (JST)
Subject: [ruby-changes:34507] nobu:r46588 (trunk): reapply r46568 "assertions.rb: refine message"

nobu	2014-06-28 00:44:20 +0900 (Sat, 28 Jun 2014)

  New Revision: 46588

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46588

  Log:
    reapply r46568 "assertions.rb: refine message"
    
    `exception` is an expected exception class, not the raised instance,
    so the result message cannot have any backtraces.

  Modified files:
    trunk/test/lib/test/unit/assertions.rb
Index: test/lib/test/unit/assertions.rb
===================================================================
--- test/lib/test/unit/assertions.rb	(revision 46587)
+++ test/lib/test/unit/assertions.rb	(revision 46588)
@@ -126,7 +126,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L126
           raise TypeError, "Expected #{expected.inspect} to be a kind of String or Regexp, not #{expected.class}"
         end
 
-        ex = assert_raise(exception, *msg) {yield}
+        ex = assert_raise(exception, msg || proc {"Exception(#{exception}) with message matches to #{expected.inspect}"}) {yield}
         msg = message(msg, "") {"Expected Exception(#{exception}) was raised, but the message doesn't match"}
 
         if assert == :assert_equal

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

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