зеркало из https://github.com/github/ruby.git
class.c: missing unknown_keyword_error
* class.c (rb_get_kwargs): when values are stored, corresponding keys have been remove from the keyword hash, and the hash should be empty in that case. [ruby-dev:49893] [Bug #13004] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b62e322017
Коммит
f5ef84cb5e
2
class.c
2
class.c
|
@ -1896,7 +1896,7 @@ rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, V
|
|||
}
|
||||
}
|
||||
if (!rest && keyword_hash) {
|
||||
if (RHASH_SIZE(keyword_hash) > (unsigned int)j) {
|
||||
if (RHASH_SIZE(keyword_hash) > (unsigned int)(values ? 0 : j)) {
|
||||
unknown_keyword_error(keyword_hash, table, required+optional);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -546,6 +546,13 @@ class TestKeywordArguments < Test::Unit::TestCase
|
|||
}
|
||||
end
|
||||
|
||||
def test_unknown_keyword
|
||||
bug13004 = '[ruby-dev:49893] [Bug #13004]'
|
||||
assert_raise_with_message(ArgumentError, /unknown keyword: invalid-argument/, bug13004) {
|
||||
[].sample(random: nil, "invalid-argument": nil)
|
||||
}
|
||||
end
|
||||
|
||||
def test_super_with_anon_restkeywords
|
||||
bug10659 = '[ruby-core:67157] [Bug #10659]'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче