diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-18 15:37:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-18 15:37:22 +0000 |
commit | 65c68b606e40d75b0a6b5780b54d5b503b8ee810 (patch) | |
tree | 195f369ae27cb705f217aca04b2895e2ef18adff /test/ruby/test_m17n.rb | |
parent | 4bfb24fe8f79ab1ddf71e9ba271e80fa4e66e303 (diff) | |
download | ruby-65c68b606e40d75b0a6b5780b54d5b503b8ee810.tar.gz ruby-65c68b606e40d75b0a6b5780b54d5b503b8ee810.tar.xz ruby-65c68b606e40d75b0a6b5780b54d5b503b8ee810.zip |
* sprintf.c (rb_str_format): set result encoding for wider width.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n.rb')
-rw-r--r-- | test/ruby/test_m17n.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 9e4c06123..5d8deee2b 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -687,12 +687,44 @@ class TestM17N < Test::Unit::TestCase #assert_strenc("\"\xC2\xA1\"", 'Windows-31J', s("%p") % s("\xc2\xa1")) assert_strenc("\"\xC2\xA1\"", 'UTF-8', u("%p") % u("\xc2\xa1")) + assert_strenc('"\xC2\xA1"', 'ASCII-8BIT', "%10p" % a("\xc2\xa1")) + assert_strenc(" \"\xC2\xA1\"", 'EUC-JP', "%10p" % e("\xc2\xa1")) + #assert_strenc(" \"\xC2\xA1\"", 'Windows-31J', "%10p" % s("\xc2\xa1")) + assert_strenc(" \"\xC2\xA1\"", 'UTF-8', "%10p" % u("\xc2\xa1")) + assert_strenc('"\x00"', 'ASCII-8BIT', a("%p") % a("\x00")) assert_strenc('"\x00"', 'EUC-JP', e("%p") % e("\x00")) assert_strenc('"\x00"', 'Windows-31J', s("%p") % s("\x00")) assert_strenc('"\x00"', 'UTF-8', u("%p") % u("\x00")) end + def test_sprintf_s + assert_strenc('', 'ASCII-8BIT', a("%s") % a("")) + assert_strenc('', 'EUC-JP', e("%s") % e("")) + assert_strenc('', 'Windows-31J', s("%s") % s("")) + assert_strenc('', 'UTF-8', u("%s") % u("")) + + assert_strenc('a', 'ASCII-8BIT', a("%s") % a("a")) + assert_strenc('a', 'EUC-JP', e("%s") % e("a")) + assert_strenc('a', 'Windows-31J', s("%s") % s("a")) + assert_strenc('a', 'UTF-8', u("%s") % u("a")) + + assert_strenc("\xC2\xA1", 'ASCII-8BIT', a("%s") % a("\xc2\xa1")) + assert_strenc("\xC2\xA1", 'EUC-JP', e("%s") % e("\xc2\xa1")) + #assert_strenc("\xC2\xA1", 'Windows-31J', s("%s") % s("\xc2\xa1")) + assert_strenc("\xC2\xA1", 'UTF-8', u("%s") % u("\xc2\xa1")) + + assert_strenc(" \xC2\xA1", 'ASCII-8BIT', "%10s" % a("\xc2\xa1")) + assert_strenc(" \xA1\xA1", 'EUC-JP', "%10s" % e("\xa1\xa1")) + #assert_strenc(" \xC2\xA1", 'Windows-31J', "%10s" % s("\xc2\xa1")) + assert_strenc(" \xC2\xA1", 'UTF-8', "%10s" % u("\xc2\xa1")) + + assert_strenc("\x00", 'ASCII-8BIT', a("%s") % a("\x00")) + assert_strenc("\x00", 'EUC-JP', e("%s") % e("\x00")) + assert_strenc("\x00", 'Windows-31J', s("%s") % s("\x00")) + assert_strenc("\x00", 'UTF-8', u("%s") % u("\x00")) + end + def test_str_lt assert(a("a") < a("\xa1")) assert(a("a") < s("\xa1")) |