зеркало из https://github.com/github/ruby.git
* pack.c (pack_pack): 'u0' is not special differently from 'm0'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
343deb4c39
Коммит
4b983b90c4
|
@ -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>
|
Sat Dec 6 14:35:06 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* pack.c (pack_pack): set US-ASCII and CODERANGE_7BIT
|
* pack.c (pack_pack): set US-ASCII and CODERANGE_7BIT
|
||||||
|
|
2
pack.c
2
pack.c
|
@ -901,7 +901,7 @@ pack_pack(VALUE ary, VALUE fmt)
|
||||||
ptr = RSTRING_PTR(from);
|
ptr = RSTRING_PTR(from);
|
||||||
plen = RSTRING_LEN(from);
|
plen = RSTRING_LEN(from);
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0 && type == 'm') {
|
||||||
encodes(res, ptr, plen, type, 0);
|
encodes(res, ptr, plen, type, 0);
|
||||||
ptr += plen;
|
ptr += plen;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -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("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("&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([""], "".unpack("u"))
|
||||||
assert_equal(["a"], "!80``\n".unpack("u"))
|
assert_equal(["a"], "!80``\n".unpack("u"))
|
||||||
assert_equal(["abc"], "#86)C\n".unpack("u"))
|
assert_equal(["abc"], "#86)C\n".unpack("u"))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче