summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2021-09-17 08:38:33 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:41 -0400
commit5506f2761f6a65ab49f415b57120eb928154625e (patch)
tree057325db503a1d3d6e4741287b1b2e34f848badc
parent82f60df5aa1e25f027a0a3fbd516d1272de39211 (diff)
Add test for setlocal
-rw-r--r--test/ruby/test_yjit.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index cd99924936..4672e83c9c 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -197,6 +197,20 @@ class TestYJIT < Test::Unit::TestCase
RUBY
end
+ def test_setlocal_with_level
+ assert_no_exits(<<~RUBY)
+ def sum(arr)
+ sum = 0
+ arr.each do |x|
+ sum += x
+ end
+ sum
+ end
+
+ sum([1,2,3])
+ RUBY
+ end
+
def test_string_then_nil
assert_compiles(<<~RUBY, insns: %i[opt_nil_p], result: true)
def foo(val)