mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (str_make_independent): should set length.
* string.c (rb_str_associate): hide associated array from ObjectSpace. * string.c (rb_str_associated): return associated array with freezing instead of false. [ruby-dev:33282] * string.c (rb_str_freeze): freeze associated array together. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ce49faf546
commit
e94ece76d8
3 changed files with 34 additions and 2 deletions
|
@ -57,4 +57,18 @@ class TestPack < Test::Unit::TestCase
|
|||
assert_raises(RangeError) { [0x80000000].pack("U") }
|
||||
assert_raises(RangeError) { [0x100000000].pack("U") }
|
||||
end
|
||||
|
||||
def test_pack_P
|
||||
a = ["abc"]
|
||||
assert_equal a, a.pack("P").unpack("P*")
|
||||
assert_equal "a", a.pack("P").unpack("P")[0]
|
||||
assert_equal a, a.pack("P").freeze.unpack("P*")
|
||||
end
|
||||
|
||||
def test_pack_p
|
||||
a = ["abc"]
|
||||
assert_equal a, a.pack("p").unpack("p*")
|
||||
assert_equal a[0], a.pack("p").unpack("p")[0]
|
||||
assert_equal a, a.pack("p").freeze.unpack("p*")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue