diff options
author | John Hawthorn <john@hawthorn.email> | 2021-06-25 23:50:19 -0700 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:37 -0400 |
commit | 4040ca82938445f8c1959c5b1e8619803ff78b1b (patch) | |
tree | 37c0a937c5970e297204ba7ce080ebf4abbff474 | |
parent | 073e3b2eab769d7ac04092b41704310a094dde81 (diff) |
more testing
-rw-r--r-- | test/ruby/test_yjit.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 8b87b55690..4c3889a3f7 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -55,6 +55,20 @@ class TestYJIT < Test::Unit::TestCase assert_compiles('-"foo" == -"bar"', insns: %i[opt_eq], stdout: 'false') end + def test_getlocal_with_level + assert_compiles(<<~RUBY, insns: %i[getlocal opt_plus], stdout: '[[7]]', exits: {leave: 2}) + def foo(foo, bar) + [1].map do |x| + [1].map do |y| + foo + bar + end + end + end + + foo(5, 2) + RUBY + end + def test_string_then_nil assert_compiles(<<~RUBY, insns: %i[opt_nil_p], stdout: 'true') def foo(val) @@ -112,8 +126,8 @@ class TestYJIT < Test::Unit::TestCase RUBY end - def test_recursion - assert_compiles(<<~'RUBY', insns: %i[opt_le opt_minus opt_plus], stdout: '34') + def test_fib_recursion + assert_compiles(<<~'RUBY', insns: %i[opt_le opt_minus opt_plus opt_send_without_block], stdout: '34') def fib(n) return n if n <= 1 fib(n-1) + fib(n-2) |