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

ruby-changes:34516

From: akr <ko1@a...>
Date: Sat, 28 Jun 2014 15:08:30 +0900 (JST)
Subject: [ruby-changes:34516] akr:r46597 (trunk): Suppress double dots.

akr	2014-06-28 15:08:24 +0900 (Sat, 28 Jun 2014)

  New Revision: 46597

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

  Log:
    Suppress double dots.

  Modified files:
    trunk/test/lib/test/unit/assertions.rb
Index: test/lib/test/unit/assertions.rb
===================================================================
--- test/lib/test/unit/assertions.rb	(revision 46596)
+++ test/lib/test/unit/assertions.rb	(revision 46597)
@@ -450,7 +450,11 @@ EOT https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L450
       def message(msg = nil, *args, &default) # :nodoc:
         if Proc === msg
           super(nil, *args) do
-            [msg.call, (default.call if default)].compact.reject(&:empty?).join(".\n")
+            ary = [msg.call, (default.call if default)].compact.reject(&:empty?)
+            if 1 < ary.length
+              ary[0...-1] = ary[0...-1].map {|str| str.sub(/(?<!\.)\z/, '.') }
+            end
+            ary.join("\n")
           end
         else
           super

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

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