[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.
This commit is contained in:
parent
55f34d4745
commit
7b05721167
@ -388,24 +388,20 @@ module Prism
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_ConstantPathTargetNode
|
def test_ConstantPathTargetNode
|
||||||
verbose = $VERBOSE
|
assert_separately([], <<~'RUBY')
|
||||||
# Create some temporary nested constants
|
verbose = $VERBOSE
|
||||||
Object.send(:const_set, "MyFoo", Object)
|
# Create some temporary nested constants
|
||||||
Object.const_get("MyFoo").send(:const_set, "Bar", Object)
|
Object.send(:const_set, "MyFoo", Object)
|
||||||
|
Object.const_get("MyFoo").send(:const_set, "Bar", Object)
|
||||||
|
|
||||||
constant_names = ["MyBar", "MyFoo::Bar", "MyFoo::Bar::Baz"]
|
constant_names = ["MyBar", "MyFoo::Bar", "MyFoo::Bar::Baz"]
|
||||||
source = "#{constant_names.join(",")} = Object"
|
source = "#{constant_names.join(",")} = Object"
|
||||||
iseq = RubyVM::InstructionSequence.compile_prism(source)
|
iseq = RubyVM::InstructionSequence.compile_prism(source)
|
||||||
$VERBOSE = nil
|
$VERBOSE = nil
|
||||||
prism_eval = iseq.eval
|
prism_eval = iseq.eval
|
||||||
$VERBOSE = verbose
|
$VERBOSE = verbose
|
||||||
assert_equal prism_eval, Object
|
assert_equal prism_eval, Object
|
||||||
ensure
|
RUBY
|
||||||
## Teardown temp constants
|
|
||||||
Object.const_get("MyFoo").send(:remove_const, "Bar")
|
|
||||||
Object.send(:remove_const, "MyFoo")
|
|
||||||
Object.send(:remove_const, "MyBar")
|
|
||||||
$VERBOSE = verbose
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_GlobalVariableTargetNode
|
def test_GlobalVariableTargetNode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user