should count only string.

This code can generate CC objects so we only need to count
existing String objects.
This commit is contained in:
Koichi Sasada 2020-02-25 13:12:53 +09:00
parent 7ec2359374
commit 670b7be6c5

View File

@ -266,10 +266,13 @@ class TestHash < Test::Unit::TestCase
end
def test_AREF_fstring_key
# warmup ObjectSpace.count_objects
ObjectSpace.count_objects
h = {"abc" => 1}
before = GC.stat(:total_allocated_objects)
before = ObjectSpace.count_objects[:T_STRING]
5.times{ h["abc"] }
assert_equal before, GC.stat(:total_allocated_objects)
assert_equal before, ObjectSpace.count_objects[:T_STRING]
end
def test_ASET_fstring_key