diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-10-24 09:47:30 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-10-24 12:35:04 -0700 |
commit | d6a2507e494f0fffca375c9e2eede38b6a777874 (patch) | |
tree | 8216d116837c7c3d291018cf96aceb4e0ad90d54 /test | |
parent | 8c59b9250c25c66d6ed16429da139558295a4517 (diff) | |
download | ruby-d6a2507e494f0fffca375c9e2eede38b6a777874.tar.gz |
Duplicate hash when converting keyword hash to keywords
This mirrors the behavior when manually splatting a hash. This
mirrors the changes made in setup_parameters_complex in
6081ddd6e6f2297862b3c7e898d28a76b8f9240b, so that splatting to a
non-iseq method works the same as splatting to an iseq method.
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_keyword.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 25337712fe..0f67c28963 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -2692,6 +2692,10 @@ class TestKeywordArguments < Test::Unit::TestCase args end + def pass_cfunc(*args) + self.class.new(*args).init_args + end + ruby2_keywords def block(*args) ->(*args, **kw){[args, kw]}.(*args) end @@ -2915,6 +2919,10 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal([[1], h1], o.foo(:pass_bar, 1, :a=>1)) end + assert_warn(/The last argument is used as the keyword parameter.* for `initialize'/m) do + assert_equal([[1], h1], o.foo(:pass_cfunc, 1, :a=>1)) + end + assert_warn(/Skipping set of ruby2_keywords flag for bar \(method accepts keywords or method does not accept argument splat\)/) do assert_nil(c.send(:ruby2_keywords, :bar)) end |