diff options
Diffstat (limited to 'test/ruby/test_eval.rb')
| -rw-r--r-- | test/ruby/test_eval.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 2129272b00..d2145bec5d 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -636,4 +636,20 @@ class TestEval < Test::Unit::TestCase end end; end + + def test_outer_local_variable_under_gc_compact_stress + omit "compaction is not supported on this platform" unless GC.respond_to?(:compact) + omit "compaction is not supported on s390x" if /s390x/ =~ RUBY_PLATFORM + + assert_separately([], <<~RUBY) + o = Object.new + def o.m = 1 + + GC.verify_compaction_references(expand_heap: true, toward: :empty) + + EnvUtil.under_gc_compact_stress do + assert_equal(1, eval("o.m")) + end + RUBY + end end |
