summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <[email protected]>2025-03-10 14:58:19 -0400
committerTakashi Kokubun <[email protected]>2025-04-18 21:52:59 +0900
commit43d532e36db81a68164f0a807c34c57b6f4a363f (patch)
treef12be58df8d82b225ded3be9f3dd1fa2d7b4193e /test
parent113080936355d2e43dbbb0bcd0b09bf93966f2f6 (diff)
Add while loop test to test_zjit.rb
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13131
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_zjit.rb20
1 files changed, 20 insertions, 0 deletions
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