diff options
Diffstat (limited to 'test/ruby/test_gc_compact.rb')
-rw-r--r-- | test/ruby/test_gc_compact.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb index da0023e6f3..be27199cdc 100644 --- a/test/ruby/test_gc_compact.rb +++ b/test/ruby/test_gc_compact.rb @@ -200,4 +200,21 @@ class TestGCCompact < Test::Unit::TestCase GC.compact assert_equal count + 1, GC.stat(:compact_count) end + + def test_compacting_from_trace_point + obj = Object.new + def obj.tracee + :ret # expected to emit both line and call event from one instruction + end + + results = [] + TracePoint.new(:call, :line) do |tp| + results << tp.event + GC.verify_compaction_references + end.enable(target: obj.method(:tracee)) do + obj.tracee + end + + assert_equal([:call, :line], results) + end end |