diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/prism/fixtures/escaped_newline_with_trailing_content.txt | 2 | ||||
| -rw-r--r-- | test/prism/fixtures/unary_method_calls.txt | 6 | ||||
| -rw-r--r-- | test/ruby/test_box.rb | 36 |
3 files changed, 44 insertions, 0 deletions
diff --git a/test/prism/fixtures/escaped_newline_with_trailing_content.txt b/test/prism/fixtures/escaped_newline_with_trailing_content.txt new file mode 100644 index 0000000000..fe947a3f10 --- /dev/null +++ b/test/prism/fixtures/escaped_newline_with_trailing_content.txt @@ -0,0 +1,2 @@ +"A +B\nCC" diff --git a/test/prism/fixtures/unary_method_calls.txt b/test/prism/fixtures/unary_method_calls.txt index dda85e4bdb..a8327d23cc 100644 --- a/test/prism/fixtures/unary_method_calls.txt +++ b/test/prism/fixtures/unary_method_calls.txt @@ -1,2 +1,8 @@ 42.~@ 42.!@ + +- +42 + ++ +42 diff --git a/test/ruby/test_box.rb b/test/ruby/test_box.rb index a39979109f..a425c5eb7d 100644 --- a/test/ruby/test_box.rb +++ b/test/ruby/test_box.rb @@ -1180,4 +1180,40 @@ class TestBox < Test::Unit::TestCase assert_equal :box2, box2.eval("Class.new { include Math }.new.box2_test") end; end + + def test_method_invalidation_between_boxes_1 + assert_separately([ENV_ENABLE_BOX], __FILE__, __LINE__, "#{<<~"begin;"}\n#{<<~'end;'}", ignore_stderr: true) + begin; + b = Ruby::Box.new + b.eval(<<~'RUBY') + Module.prepend(Module.new) + class C; end + class D < C; end + def C.===(x) = true + RUBY + + assert String === "x" + assert b # to prevent GCing b + end; + end + + def test_method_invalidation_between_boxes_2 + assert_separately([ENV_ENABLE_BOX], __FILE__, __LINE__, "#{<<~"begin;"}\n#{<<~'end;'}", ignore_stderr: true) + begin; + PrepM = Module.new + Module.prepend(PrepM) + Module.new.include?(Module.new) + + b = Ruby::Box.new + b.eval(<<~'RUBY') + Module.class_eval { def _test_method; end } + + class C; end + class D < C; end + def C.include?(x) = true + RUBY + + Module.new.include?(Module.new) + end; + end end |
