summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-09-22 19:41:52 +0900
committerNobuyoshi Nakada <[email protected]>2023-09-22 19:41:52 +0900
commitc8c35ded7427ad5742338495b2b46218616f1cb6 ()
tree219518e43b4d51a2841d4c8fd316064281cbccbc
parent50e3b27db7ebf3bceffaaa2852e00a3c27e494c7 (diff)
[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 ```
-rw-r--r--test/yarp/compiler_test.rb8
1 files changed, 7 insertions, 1 deletions
@@ -134,19 +134,25 @@ module YARP
end
def test_ConstantPathTargetNode
# 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
assert_equal yarp_eval, Object
## Teardown temp constants
Object.const_get("MyFoo").send(:remove_const, "Bar")
Object.send(:remove_const, "MyFoo")
Object.send(:remove_const, "MyBar")
end
def test_ConstantPathWriteNode