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

add tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-01-11 03:11:42 +00:00
parent 82bf2c1ac7
commit 5a1b5f8fe2

View file

@ -252,6 +252,16 @@ class TestM17N < Test::Unit::TestCase
assert_equal(false, "\xd8\x00\xd8\x00".force_encoding("utf-16be").valid_encoding?)
end
def test_utf16
assert_equal(255, "f\0f\0".force_encoding("utf-16le").hex)
assert_raise(ArgumentError) {
"aa".force_encoding("utf-16be").count("aa")
}
assert_raise(ArgumentError) {
"a".force_encoding("us-ascii") + "aa".force_encoding("utf-16be")
}
end
def test_regexp_too_short_multibyte_character
assert_raise(SyntaxError) { eval('/\xfe/e') }
assert_raise(SyntaxError) { eval('/\x8e/e') }