1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

update encdump for UTF-16.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-01-19 18:56:50 +00:00
parent 55723ea86d
commit d0ce29fbee

View file

@ -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