diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-11-29 16:51:13 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-11-29 16:51:13 +0900 |
commit | 3a87826d0c3dd4c42e327e0cd4fb0806d898497f (patch) | |
tree | 5c52f4909eea084529e8b2f7f1647b64f95be7f5 /test/ruby | |
parent | 5ad32d5504499f1a915d5d30e59dfd98da6759c6 (diff) | |
download | ruby-3a87826d0c3dd4c42e327e0cd4fb0806d898497f.tar.gz |
vm_method.c: add top-level ruby2_keywords
This is a top-level version of Module#ruby2_keywords.
It can be used for functions (top-level methods) that delegates
arguments. [Feature #16364]
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_keyword.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 29335a4963..862b6733ea 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -2985,6 +2985,18 @@ class TestKeywordArguments < Test::Unit::TestCase assert_raise(FrozenError) { c.send(:ruby2_keywords, :baz) } end + def test_top_ruby2_keywords + assert_in_out_err([], <<-INPUT, ["[1, 2, 3]", "{:k=>1}"], []) + def bar(*a, **kw) + p a, kw + end + ruby2_keywords def foo(*a) + bar(*a) + end + foo(1, 2, 3, k:1) + INPUT + end + def test_dig_kwsplat kw = {} h = {:a=>1} |