зеркало из https://github.com/github/ruby.git
[YARP] Suppress constant redefinition warning
``` <compiled>:1: warning: already initialized constant Bar test/yarp/compiler_test.rb:139: warning: previous definition of Bar was here ```
This commit is contained in:
Родитель
50e3b27db7
Коммит
c8c35ded74
|
@ -134,19 +134,25 @@ module YARP
|
|||
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"
|
||||
yarp_eval = RubyVM::InstructionSequence.compile_yarp(source).eval
|
||||
iseq = RubyVM::InstructionSequence.compile_yarp(source)
|
||||
$VERBOSE = nil
|
||||
yarp_eval = iseq.eval
|
||||
$VERBOSE = verbose
|
||||
assert_equal yarp_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
|
||||
end
|
||||
|
||||
def test_ConstantPathWriteNode
|
||||
|
|
Загрузка…
Ссылка в новой задаче