diff options
| author | Matt Valentine-House <matt@eightbitraptor.com> | 2023-09-19 21:59:07 +0100 |
|---|---|---|
| committer | Matt Valentine-House <matt@eightbitraptor.com> | 2023-09-21 23:00:49 +0100 |
| commit | bf129370d32da9b673d242bb3c9661f2188b3ad0 (patch) | |
| tree | 69ca53bdab7dd24f384b591bf0e19d10ea23bb82 /test | |
| parent | 48b141b49dc1f6509e33fb94d4beb474862d9b0a (diff) | |
[YARP] Implement ConstantPathTargetNode
Co-Authored-By: kddnewton <kevin.newton@shopify.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/yarp/compiler_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/yarp/compiler_test.rb b/test/yarp/compiler_test.rb index 18303579de..f525f9c1a2 100644 --- a/test/yarp/compiler_test.rb +++ b/test/yarp/compiler_test.rb @@ -133,6 +133,22 @@ module YARP Object.send(:remove_const, constant_name) 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 # test_yarp_eval("YARP::YCT = 1") end |
