From 4d1ee83e3c1e87597e0abb15dffd15d4b450d9be Mon Sep 17 00:00:00 2001 From: kazu Date: Fri, 18 Jan 2008 05:43:03 +0000 Subject: [PATCH] * test/ruby/test_m17n.rb (test_str_dump): added test for String#dump. [ruby-dev:33142] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ test/ruby/test_m17n.rb | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/ChangeLog b/ChangeLog index 86f5b595b5..e540da545c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jan 18 14:36:34 2008 Kazuhiro NISHIYAMA + + * test/ruby/test_m17n.rb (test_str_dump): added test for + String#dump. [ruby-dev:33142] + Fri Jan 18 12:25:13 2008 Nobuyoshi Nakada * encoding.c (load_encoding): check if successfully loaded. diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index f04c386224..9e4c061233 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -189,6 +189,44 @@ class TestM17N < Test::Unit::TestCase assert_equal('"\xFC"', u("\xfc").inspect) end + def test_str_dump + [ + e("\xfe"), + e("\x8e"), + e("\x8f"), + e("\x8f\xa1"), + s("\xef"), + u("\xc2"), + u("\xe0\x80"), + u("\xf0\x80\x80"), + u("\xf8\x80\x80\x80"), + u("\xfc\x80\x80\x80\x80"), + + e("\xfe "), + e("\x8e "), + e("\x8f "), + e("\x8f\xa1 "), + s("\xef "), + u("\xc2 "), + u("\xe0\x80 "), + u("\xf0\x80\x80 "), + u("\xf8\x80\x80\x80 "), + u("\xfc\x80\x80\x80\x80 "), + + + e("\xa1\x8f\xa1\xa1"), + + s("\x81."), + s("\x81@"), + + u("\xfc"), + "\u3042", + "ascii", + ].each do |str| + assert_equal(str, eval(str.dump), "[ruby-dev:33142]") + end + end + def test_validate_redundant_utf8 bits_0x10ffff = "11110100 10001111 10111111 10111111" [