diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/yarp/compiler_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/yarp/compiler_test.rb b/test/yarp/compiler_test.rb index b8a636d984..c6b7fed1eb 100644 --- a/test/yarp/compiler_test.rb +++ b/test/yarp/compiler_test.rb @@ -103,6 +103,20 @@ module YARP test_yarp_eval("class YARP::CompilerTest; @@yct = 0; @@yct += 1; end") end + def test_ConstantTargetNode + # We don't call test_yarp_eval directly in this case becuase we + # don't want to assign the constant mutliple times if we run + # with `--repeat-count` + # Instead, we eval manually here, and remove the constant to + constant_names = ["YCT", "YCT2"] + source = "#{constant_names.join(",")} = 1" + yarp_eval = RubyVM::InstructionSequence.compile_yarp(source).eval + assert_equal yarp_eval, 1 + constant_names.map { |name| + Object.send(:remove_const, name) + } + end + def test_ConstantWriteNode # We don't call test_yarp_eval directly in this case becuase we # don't want to assign the constant mutliple times if we run |
