summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2021-07-17 03:26:46 -0700
committerAlan Wu <[email protected]>2021-10-20 18:19:39 -0400
commitc210fade27c2f39f078c9b1aec71a05532fb832b (patch)
tree3947355e6e0f5572d38261946df6c16080eb3a7b /test
parent3a3f7066986b6d0a24a6f7c72d2304381269b30d (diff)
Implement newrange
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_yjit.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 50b415107d..94989dae9e 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -36,6 +36,14 @@ class TestYJIT < Test::Unit::TestCase
assert_compiles('[1, 2, 3]', insns: %i[duparray], result: [1, 2, 3])
end
+ def test_compile_newrange
+ assert_compiles('s = 1; (s..5)', insns: %i[newrange], result: 1..5)
+ assert_compiles('s = 1; e = 5; (s..e)', insns: %i[newrange], result: 1..5)
+ assert_compiles('s = 1; (s...5)', insns: %i[newrange], result: 1...5)
+ assert_compiles('s = 1; (s..)', insns: %i[newrange], result: 1..)
+ assert_compiles('e = 5; (..e)', insns: %i[newrange], result: ..5)
+ end
+
def test_compile_opt_nil_p
assert_compiles('nil.nil?', insns: %i[opt_nil_p], result: true)
assert_compiles('false.nil?', insns: %i[opt_nil_p], result: false)