diff options
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_zjit.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index 8e450458dd..e79e80fb44 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -807,6 +807,60 @@ class TestZJIT < Test::Unit::TestCase } end + def test_new_range_fixnum_both_literals_inclusive + assert_compiles '1..2', %q{ + def test() + (1..2) + end + test; test + }, call_threshold: 2 + end + + def test_new_range_fixnum_both_literals_exclusive + assert_compiles '1...2', %q{ + def test() + (1...2) + end + test; test + }, call_threshold: 2 + end + + def test_new_range_fixnum_low_literal_inclusive + assert_compiles '1..3', %q{ + def test(a) + (1..a) + end + test(2); test(3) + }, call_threshold: 2 + end + + def test_new_range_fixnum_low_literal_exclusive + assert_compiles '1...3', %q{ + def test(a) + (1...a) + end + test(2); test(3) + }, call_threshold: 2 + end + + def test_new_range_fixnum_high_literal_inclusive + assert_compiles '3..10', %q{ + def test(a) + (a..10) + end + test(2); test(3) + }, call_threshold: 2 + end + + def test_new_range_fixnum_high_literal_exclusive + assert_compiles '3...10', %q{ + def test(a) + (a...10) + end + test(2); test(3) + }, call_threshold: 2 + end + def test_if assert_compiles '[0, nil]', %q{ def test(n) |
