diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-11 03:11:42 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-11 03:11:42 +0000 |
commit | 5a1b5f8fe2eea72eeb3fcdd54d1ab8b954828bbd (patch) | |
tree | 67630008a2ffd8f504c7338521514e6720d9c5ed /test/ruby/test_m17n.rb | |
parent | 82bf2c1ac7e4398e57a102119fdf16beb02a6e24 (diff) | |
download | ruby-5a1b5f8fe2eea72eeb3fcdd54d1ab8b954828bbd.tar.gz |
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n.rb')
-rw-r--r-- | test/ruby/test_m17n.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 288b084cdf..e5dc3840d9 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -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') } |