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

ruby-changes:39987

From: nobu <ko1@a...>
Date: Wed, 7 Oct 2015 11:20:43 +0900 (JST)
Subject: [ruby-changes:39987] nobu:r52068 (trunk): assertions.rb: refine all_assertions

nobu	2015-10-07 11:19:59 +0900 (Wed, 07 Oct 2015)

  New Revision: 52068

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

  Log:
    assertions.rb: refine all_assertions
    
    * test/lib/test/unit/assertions.rb (all_assertions): refine
      total failiure message.

  Modified files:
    trunk/test/lib/test/unit/assertions.rb
Index: test/lib/test/unit/assertions.rb
===================================================================
--- test/lib/test/unit/assertions.rb	(revision 52067)
+++ test/lib/test/unit/assertions.rb	(revision 52068)
@@ -454,14 +454,24 @@ EOT https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L454
         rescue Exception => e
           @failures[key] = e
         end
+
+        def message
+          i = 0
+          @failures.map {|k, v|
+            "\n#{i+=1}. Assertion for #{k.inspect}\n#{v.message.gsub(/^/, '   | ')}"
+          }.join("\n")
+        end
+
+        def pass?
+          @failures.empty?
+        end
       end
 
       def all_assertions(msg = nil)
         all = AllFailures.new
         yield all
       ensure
-        failures = all.failures
-        assert(failures.empty?, message(msg) {mu_pp(failures)})
+        assert(all.pass?, message(msg) {all.message})
       end
 
       def build_message(head, template=nil, *arguments) #:nodoc:

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

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