summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-09-05 16:27:26 +0900
committerJeremy Evans <code@jeremyevans.net>2019-09-05 17:47:12 -0700
commitc5555e2eb8631e649cc9377f0bd75ebc2788cc7d (patch)
tree695cab1eadab4892af702bcba161f3f56bdf055f /test
parenta23ddf7ff58ec77548d2ecd7f9f202aa3eff9fc7 (diff)
downloadruby-c5555e2eb8631e649cc9377f0bd75ebc2788cc7d.tar.gz
CALLER_SETUP_ARG removes an empty keyword hash from argv
...only when a "remove_empty_keyword_hash" flag is specified. After CALLER_SETUP_ARG is called, `ci->flag & VM_CALL_KW_SPLAT` must not be used. Instead. use `calling->kw_splat`. This is because CALLER_SETUP_ARG may modify argv and update `calling->kw_splat`, and `ci->flag & VM_CALL_KW_SPLAT` may be inconsistent with the result.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_keyword.rb20
1 files changed, 5 insertions, 15 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index 9e32faa9ec..98e121f124 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -464,12 +464,8 @@ class TestKeywordArguments < Test::Unit::TestCase
def c.m(arg, **args)
[arg, args]
end
- assert_warn(/The keyword argument is passed as the last hash parameter.* for `m'/m) do
- assert_equal([kw, kw], c.send(:m, **{}))
- end
- assert_warn(/The keyword argument is passed as the last hash parameter.* for `m'/m) do
- assert_equal([kw, kw], c.send(:m, **kw))
- end
+ assert_raise(ArgumentError) { c.send(:m, **{}) }
+ assert_raise(ArgumentError) { c.send(:m, **kw) }
assert_warn(/The keyword argument is passed as the last hash parameter.* for `m'/m) do
assert_equal([h, kw], c.send(:m, **h))
end
@@ -643,12 +639,8 @@ class TestKeywordArguments < Test::Unit::TestCase
def c.method_missing(_, arg, **args)
[arg, args]
end
- assert_warn(/The keyword argument is passed as the last hash parameter.* for `method_missing'/m) do
- assert_equal([kw, kw], c.send(:m, **{}))
- end
- assert_warn(/The keyword argument is passed as the last hash parameter.* for `method_missing'/m) do
- assert_equal([kw, kw], c.send(:m, **kw))
- end
+ assert_raise(ArgumentError) { c.send(:m, **{}) }
+ assert_raise(ArgumentError) { c.send(:m, **kw) }
assert_warn(/The keyword argument is passed as the last hash parameter.* for `method_missing'/m) do
assert_equal([h, kw], c.send(:m, **h))
end
@@ -737,9 +729,7 @@ class TestKeywordArguments < Test::Unit::TestCase
define_method(:m) {|arg, **opt| [arg, opt] }
end
assert_raise(ArgumentError) { c.m(**{}) }
- assert_warn(/The keyword argument is passed as the last hash parameter/m) do
- assert_equal([kw, kw], c.m(**kw))
- end
+ assert_raise(ArgumentError) { c.m(**kw) }
assert_warn(/The keyword argument is passed as the last hash parameter/m) do
assert_equal([h, kw], c.m(**h))
end