diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-06 08:55:57 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-06 08:55:57 +0000 |
| commit | ca3608096d23f4cd76ce3b8d07cd9f4bf8030c00 (patch) | |
| tree | 29c91be257e45cdfbcafa7e6cda825462592beeb | |
| parent | 2efa2847079c55018bf36174c45384e247bb22c6 (diff) | |
| download | ruby-ca3608096d23f4cd76ce3b8d07cd9f4bf8030c00.tar.gz ruby-ca3608096d23f4cd76ce3b8d07cd9f4bf8030c00.tar.xz ruby-ca3608096d23f4cd76ce3b8d07cd9f4bf8030c00.zip | |
* pack.c (pack_pack): 'u0' is not special differently from 'm0'.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | pack.c | 2 | ||||
| -rw-r--r-- | test/ruby/test_pack.rb | 4 |
3 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Sat Dec 6 17:51:35 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp> + + * pack.c (pack_pack): 'u0' is not special differently from 'm0'. + Sat Dec 6 14:35:06 2008 NARUSE, Yui <naruse@ruby-lang.org> * pack.c (pack_pack): set US-ASCII and CODERANGE_7BIT @@ -901,7 +901,7 @@ pack_pack(VALUE ary, VALUE fmt) ptr = RSTRING_PTR(from); plen = RSTRING_LEN(from); - if (len == 0) { + if (len == 0 && type == 'm') { encodes(res, ptr, plen, type, 0); ptr += plen; break; diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb index 2666bb0e9..33694b9f3 100644 --- a/test/ruby/test_pack.rb +++ b/test/ruby/test_pack.rb @@ -349,6 +349,10 @@ class TestPack < Test::Unit::TestCase assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u")) assert_equal("&86)C9&5F\n#9VAI\n", ["abcdefghi"].pack("u6")) + assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u0")) + assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u1")) + assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u2")) + assert_equal([""], "".unpack("u")) assert_equal(["a"], "!80``\n".unpack("u")) assert_equal(["abc"], "#86)C\n".unpack("u")) |
