From d0ce29fbee96a7a0b55f9c8f5e7e4b1b617a631b Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 19 Jan 2008 18:56:50 +0000 Subject: [PATCH] update encdump for UTF-16. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_m17n.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 0ad7da9a60..8bdcd26c4b 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -79,7 +79,12 @@ class TestM17N < Test::Unit::TestCase end def encdump(str) - "#{str.dump}.force_encoding(#{str.encoding.name.dump})" + d = str.dump + if /\.force_encoding\("[A-Za-z0-9.:_+-]*"\)\z/ =~ d + d + else + "#{d}.force_encoding(#{str.encoding.name.dump})" + end end def encdumpargs(args) @@ -287,7 +292,8 @@ class TestM17N < Test::Unit::TestCase end def test_utf16_valid_encoding - assert_equal(false, "\xd8\x00\xd8\x00".force_encoding("utf-16be").valid_encoding?) + s = "\xd8\x00\xd8\x00".force_encoding("utf-16be") + assert_equal(false, s.valid_encoding?, "#{encdump s}.valid_encoding?") end def test_utf16