diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2019-09-09 15:46:07 -0700 |
---|---|---|
committer | Aaron Patterson <tenderlove@ruby-lang.org> | 2019-09-26 15:41:46 -0700 |
commit | 293c6c8cc3cd9a9cb2910672589ee3631e1f1653 (patch) | |
tree | ba7330ecfac15e4a60c88db7994a6a38d36da2c2 /test/ruby/test_gc_compact.rb | |
parent | 37f9213f8957e0c6dffee7d8803890907f97bdbb (diff) | |
download | ruby-293c6c8cc3cd9a9cb2910672589ee3631e1f1653.tar.gz |
Add compaction support to `rb_ast_t`
This commit adds compaction support to `rb_ast_t`.
Diffstat (limited to 'test/ruby/test_gc_compact.rb')
-rw-r--r-- | test/ruby/test_gc_compact.rb | 14 |
1 files changed, 14 insertions, 0 deletions
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 |