From 43d532e36db81a68164f0a807c34c57b6f4a363f Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Mon, 10 Mar 2025 14:58:19 -0400 Subject: Add while loop test to test_zjit.rb --- test/ruby/test_zjit.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test') diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index 5265aac246..694a5032da 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -73,6 +73,26 @@ class TestZJIT < Test::Unit::TestCase }, call_threshold: 2 end + def test_less_than + assert_compiles 'true', %q{ + def test(a, b) = a < b + test(2, 5) + }, call_threshold: 2 + end + + def test_while_loop + assert_compiles '10', %q{ + def loop_fun(n) + i = 0 + while i < n + i = i + 1 + end + i + end + loop_fun(10) + }, call_threshold: 2 + end + private # Assert that every method call in `test_script` can be compiled by ZJIT -- cgit v1.2.3