summaryrefslogtreecommitdiff
path: root/test/-ext-/string/test_set_len.rb
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-02-01 09:25:12 -0500
committerPeter Zhu <peter@peterzhu.ca>2022-02-02 09:52:04 -0500
commit7b77d46671685c837adc33b39ae0210e04cd8b24 (patch)
tree426dd92de0af81c4d6cbc3f0af732cc7fe80ede8 /test/-ext-/string/test_set_len.rb
parentaf107710457b4bd148c6e5ee7a336ed4961f5423 (diff)
Decouple GC slot sizes from RVALUE
Add a new macro BASE_SLOT_SIZE that determines the slot size. For Variable Width Allocation (compiled with USE_RVARGC=1), all slot sizes are powers-of-2 multiples of BASE_SLOT_SIZE. For USE_RVARGC=0, BASE_SLOT_SIZE is set to sizeof(RVALUE).
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5517
Diffstat (limited to 'test/-ext-/string/test_set_len.rb')
-rw-r--r--test/-ext-/string/test_set_len.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/-ext-/string/test_set_len.rb b/test/-ext-/string/test_set_len.rb
index 5216e6195f..67ba961194 100644
--- a/test/-ext-/string/test_set_len.rb
+++ b/test/-ext-/string/test_set_len.rb
@@ -4,18 +4,20 @@ require "-test-/string"
class Test_StrSetLen < Test::Unit::TestCase
def setup
- @s0 = [*"a".."z"].join("").freeze
+ # Make string long enough so that it is not embedded
+ @range_end = ("0".ord + GC::INTERNAL_CONSTANTS[:BASE_SLOT_SIZE]).chr
+ @s0 = [*"0"..@range_end].join("").freeze
@s1 = Bug::String.new(@s0)
end
def teardown
- orig = [*"a".."z"].join("")
+ orig = [*"0"..@range_end].join("")
assert_equal(orig, @s0)
end
def test_non_shared
@s1.modify!
- assert_equal("abc", @s1.set_len(3))
+ assert_equal("012", @s1.set_len(3))
end
def test_shared