summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoreileencodes <[email protected]>2021-07-27 14:57:30 -0400
committerAlan Wu <[email protected]>2021-10-20 18:19:38 -0400
commitb91078ea743fda959ad42f17562c4f3091bcf585 (patch)
treee1f19c0a92ea733f5e102c99767aae23065fd426 /test
parentdd23e4658b8587adf8d6fed96b574a979b169e46 (diff)
Add setglobal to yjit
Adds yjit support for setting global variables. Co-authored-by: Aaron Patterson <[email protected]> Co-authored-by: John Hawthorn <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_yjit.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 8b61a1dbfc..22b78a4e2d 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -55,6 +55,10 @@ class TestYJIT < Test::Unit::TestCase
assert_compiles('-"foo" == -"bar"', insns: %i[opt_eq], result: false)
end
+ def test_compile_set_and_get_global
+ assert_compiles('$foo = 123; $foo', insns: %i[setglobal], result: 123)
+ end
+
def test_getlocal_with_level
assert_compiles(<<~RUBY, insns: %i[getlocal opt_plus], result: [[7]])
def foo(foo, bar)