summaryrefslogtreecommitdiff
path: root/test/ruby/test_yjit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_yjit.rb')
-rw-r--r--test/ruby/test_yjit.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 9b26e6c37f..7b8cde6c0c 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -85,6 +85,16 @@ class TestYJIT < Test::Unit::TestCase
assert_compiles('e = 5; (..e)', insns: %i[newrange], result: ..5)
end
+ def test_compile_duphash
+ assert_compiles('{ two: 2 }', insns: %i[duphash], result: { two: 2 })
+ end
+
+ def test_compile_newhash
+ assert_compiles('{}', insns: %i[newhash], result: {})
+ assert_compiles('{ two: 1 + 1 }', insns: %i[newhash], result: { two: 2 })
+ assert_compiles('{ 1 + 1 => :two }', insns: %i[newhash], result: { 2 => :two })
+ 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)