diff options
author | Alan Wu <[email protected]> | 2023-11-28 12:30:30 -0500 |
---|---|---|
committer | Alan Wu <[email protected]> | 2023-11-28 12:30:30 -0500 |
commit | 7b057211670c05134f107cfaf2740f8d1a6de09a (patch) | |
tree | 80463baad713ae395e091293f4b1273f4020360a | |
parent | 55f34d474592f4ff5332615c7e4baf6270e7090d (diff) |
[PRISM] Run test setting global constant separately
This impacted other tests. Please mind the commons.
/home/runner/work/ruby/ruby/src/test/ruby/test_compile_prism.rb:394: warning: already initialized constant Bar
/tmp/test_reline_config_60145/bazbarbob.rb:6: warning: previous definition of Bar was here
1) Failure:
TestModule#test_const_get_evaled [/home/runner/work/ruby/ruby/src/test/ruby/test_module.rb:1239]:
NameError expected but nothing was raised.
-rw-r--r-- | test/ruby/test_compile_prism.rb | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index c1a32b84fd..2f3c2dc062 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -388,24 +388,20 @@ module Prism end def test_ConstantPathTargetNode - verbose = $VERBOSE - # Create some temporary nested constants - Object.send(:const_set, "MyFoo", Object) - Object.const_get("MyFoo").send(:const_set, "Bar", Object) - - constant_names = ["MyBar", "MyFoo::Bar", "MyFoo::Bar::Baz"] - source = "#{constant_names.join(",")} = Object" - iseq = RubyVM::InstructionSequence.compile_prism(source) - $VERBOSE = nil - prism_eval = iseq.eval - $VERBOSE = verbose - assert_equal prism_eval, Object - ensure - ## Teardown temp constants - Object.const_get("MyFoo").send(:remove_const, "Bar") - Object.send(:remove_const, "MyFoo") - Object.send(:remove_const, "MyBar") - $VERBOSE = verbose + assert_separately([], <<~'RUBY') + verbose = $VERBOSE + # Create some temporary nested constants + Object.send(:const_set, "MyFoo", Object) + Object.const_get("MyFoo").send(:const_set, "Bar", Object) + + constant_names = ["MyBar", "MyFoo::Bar", "MyFoo::Bar::Baz"] + source = "#{constant_names.join(",")} = Object" + iseq = RubyVM::InstructionSequence.compile_prism(source) + $VERBOSE = nil + prism_eval = iseq.eval + $VERBOSE = verbose + assert_equal prism_eval, Object + RUBY end def test_GlobalVariableTargetNode |