diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-17 16:50:49 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-17 16:50:49 +0000 |
commit | c2c32b50b18ff48882c51a6cbd2287646f27a267 (patch) | |
tree | b033bd6d8b2f321311741d5ea1b75aabe4e386d3 /test/ruby/test_utf16.rb | |
parent | 583a4b1774a9458585fe896b7756e5e3e39beb32 (diff) | |
download | ruby-c2c32b50b18ff48882c51a6cbd2287646f27a267.tar.gz |
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_utf16.rb')
-rw-r--r-- | test/ruby/test_utf16.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_utf16.rb b/test/ruby/test_utf16.rb index 9074aa7233..2593de6375 100644 --- a/test/ruby/test_utf16.rb +++ b/test/ruby/test_utf16.rb @@ -136,6 +136,11 @@ EOT assert_equal(255, s1.hex, "#{encdump s1}.hex") end + def test_oct + assert_equal(077, "77".encode("utf-16le").oct) + assert_equal(077, "77".encode("utf-16be").oct) + end + def test_count s1 = "aa".force_encoding("utf-16be") s2 = "aa" @@ -239,4 +244,19 @@ EOT assert_equal(Encoding.find("utf-16be"), Regexp.new(s).encoding, "Regexp.new(#{encdump s}).encoding") end + + def test_gsub + s = "abcd".force_encoding("utf-16be") + assert_raise(ArgumentError) { + s.gsub(Regexp.new(".".encode("utf-16be")), "xy") + } + end + + def test_split_awk + s = " ab cd ".encode("utf-16be") + r = s.split(" ".encode("utf-16be")) + assert_equal(2, r.length) + assert_str_equal("ab".encode("utf-16be"), r[0]) + assert_str_equal("cd".encode("utf-16be"), r[1]) + end end |