diff options
author | John Hawthorn <john@hawthorn.email> | 2021-10-27 07:55:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-27 10:55:43 -0400 |
commit | a6104b392ab347c323c93a51fb3b95c3c2cc9e8f (patch) | |
tree | efdd4e67c454a3f14d7507d036bf801384b752bb /test | |
parent | 5086c25f6015558877f85c3f1c014780b08fd3ce (diff) |
YJIT: Support newhash with values (#5029)
* YJIT: Implement newhash with values
* YJIT: Add test of duphash
* Fix compilation on macos/clang
Notes
Notes:
Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_yjit.rb | 10 |
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) |