ruby-changes:47343
From: nobu <ko1@a...>
Date: Tue, 1 Aug 2017 20:59:49 +0900 (JST)
Subject: [ruby-changes:47343] nobu:r59459 (trunk): assertions.rb: AllFailures#message encoding
nobu 2017-08-01 20:59:45 +0900 (Tue, 01 Aug 2017) New Revision: 59459 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59459 Log: assertions.rb: AllFailures#message encoding * test/lib/test/unit/assertions.rb (AllFailures#message): put indented messages back to the original encoding, to get rid of Encoding::CompatibilityError when key has non-ASCII characters. Modified files: trunk/test/lib/test/unit/assertions.rb Index: test/lib/test/unit/assertions.rb =================================================================== --- test/lib/test/unit/assertions.rb (revision 59458) +++ test/lib/test/unit/assertions.rb (revision 59459) @@ -888,7 +888,8 @@ eom https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L888 total = @count.to_s fmt = "%#{total.size}d" @failures.map {|k, (n, v)| - "\n#{i+=1}. [#{fmt%n}/#{total}] Assertion for #{k.inspect}\n#{v.message.b.gsub(/^/, ' | ')}" + v = v.message + "\n#{i+=1}. [#{fmt%n}/#{total}] Assertion for #{k.inspect}\n#{v.b.gsub(/^/, ' | ').force_encoding(v.encoding)}" }.join("\n") end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/