summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-20 00:51:52 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-20 00:51:52 +0000
commite49820a827a6c495fcaf19fc7398316409fd1953 (patch)
tree7b05a25be5d813211d986f5586567e7af47ec696 /test
parent54a230bf7a7d70e51bff33316971b5b3e2e05cc2 (diff)
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_m17n.rb21
1 files changed, 16 insertions, 5 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 8bdcd26c4b..10be0433f0 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -297,12 +297,23 @@ class TestM17N < Test::Unit::TestCase
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")
+ s1 = "ab".force_encoding("utf-16be")
+ s2 = "b".force_encoding("utf-16be")
+ assert_equal(false, s1.end_with?(s2), "#{encdump s1}.end_with?(#{encdump s2})")
+
+ s1 = "f\0f\0".force_encoding("utf-16le")
+ assert_equal(255, s1.hex, "#{encdump s1}.hex")
+
+ s1 = "aa".force_encoding("utf-16be")
+ s2 = "aa"
+ assert_raise(ArgumentError, "#{encdump s1}.count(#{encdump s2})") {
+ s1.count(s2)
}
- assert_raise(ArgumentError) {
- "a".force_encoding("us-ascii") + "aa".force_encoding("utf-16be")
+
+ s1 = "a".force_encoding("us-ascii")
+ s2 = "aa".force_encoding("utf-16be")
+ assert_raise(ArgumentError, "#{encdump s1} + #{encdump s2}") {
+ s1 + s2
}
end