diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-02-25 13:12:53 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-02-25 13:12:53 +0900 |
commit | 670b7be6c5fb9c3438fb6e36070401f25806f725 (patch) | |
tree | 36ae418544eab30520ad2613304a4205801c93aa | |
parent | 7ec23593746c8ccabd6c005cc34dde77d564c6c9 (diff) | |
download | ruby-670b7be6c5fb9c3438fb6e36070401f25806f725.tar.gz |
should count only string.
This code can generate CC objects so we only need to count
existing String objects.
-rw-r--r-- | test/ruby/test_hash.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 98ddbef1eb..3c799b7a04 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -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 |