diff options
author | Jemma Issroff <[email protected]> | 2022-11-09 17:04:35 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2022-11-10 09:26:37 -0500 |
commit | 199b59f065ce6f1c13b8424f35a70c513523211b (patch) | |
tree | d12bed8a9afdb67684bf904be9bba706e09bfe7c /test | |
parent | 68bd1d685579f9ae96f1c8160cf1fd9820e508da (diff) |
Fix bug in array pack with shared strings
If string literals are long and they become shared, we need to make them
independent before we can write to them. [Bug #19116]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6704
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_array.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 20e6ee7917..f58f8a2778 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1294,6 +1294,12 @@ class TestArray < Test::Unit::TestCase =end end + def test_pack_with_buffer + n = [ 65, 66, 67 ] + str = "a" * 100 + assert_equal("aaaABC", n.pack("@3ccc", buffer: str.dup), "[Bug #19116]") + end + def test_pop a = @cls[ 'cat', 'dog' ] assert_equal('dog', a.pop) |