From 293c6c8cc3cd9a9cb2910672589ee3631e1f1653 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 9 Sep 2019 15:46:07 -0700 Subject: Add compaction support to `rb_ast_t` This commit adds compaction support to `rb_ast_t`. --- test/ruby/test_gc_compact.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ruby/test_gc_compact.rb') diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb index ca4a285b70..eaffccda08 100644 --- a/test/ruby/test_gc_compact.rb +++ b/test/ruby/test_gc_compact.rb @@ -130,4 +130,18 @@ class TestGCCompact < Test::Unit::TestCase GC.verify_compaction_references(toward: :empty) assert_equal hash, list_of_objects.hash end + + def walk_ast ast + children = ast.children.grep(RubyVM::AbstractSyntaxTree::Node) + children.each do |child| + assert child.type + walk_ast child + end + end + + def test_ast_compacts + ast = RubyVM::AbstractSyntaxTree.parse_file __FILE__ + assert GC.compact + walk_ast ast + end end -- cgit v1.2.3