summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-23 06:04:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-23 06:04:13 +0000
commite94ece76d8d73b5e8a61531fe68f5e08ee78f8dc (patch)
tree41e21e35c7e13ca5d540430fdaee2cabfe1baf85 /test
parentce49faf5465abede7b0687b1b6f05658d4c7f802 (diff)
* 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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_pack.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb
index e67465b33a..f78c48dee6 100644
--- a/test/ruby/test_pack.rb
+++ b/test/ruby/test_pack.rb
@@ -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