summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2022-01-05 16:00:21 -0800
committerJohn Hawthorn <john@hawthorn.email>2022-01-10 10:53:31 -0800
commit930ebdd7ca4dfb9386fcaa52909dadb970163f8e (patch)
tree01d4008b7d4d68bf35d63d2e4d7305add5b46362 /test/ruby
parenta9dc0c59e314de66f56d0a1a551a74c96fd11c8d (diff)
YJIT: Support kwargs for cfunc
This adds support for passing keyword arguments to cfuncs. This is done by calling a helper method to create the hash from the top N values on the stack (determined by the callinfo) and then moving that value onto the stack.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5397
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_yjit.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 41a6d50779..88f8e42813 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -523,6 +523,13 @@ class TestYJIT < Test::Unit::TestCase
RUBY
end
+ def test_cfunc_kwarg
+ assert_no_exits('{}.store(:value, foo: 123)')
+ assert_no_exits('{}.store(:value, foo: 123, bar: 456, baz: 789)')
+ assert_no_exits('{}.merge(foo: 123)')
+ assert_no_exits('{}.merge(foo: 123, bar: 456, baz: 789)')
+ end
+
def test_ctx_different_mappings
# regression test simplified from URI::Generic#hostname=
assert_compiles(<<~'RUBY', frozen_string_literal: true)