зеркало из https://github.com/github/ruby.git
test_keyword.rb: more assertions
* test/ruby/test_keyword.rb (test_block_required_keyword): more assertions for positional and require keyword parameters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
a65982f00f
Коммит
98763860a7
|
@ -386,6 +386,15 @@ class TestKeywordArguments < Test::Unit::TestCase
|
|||
assert_equal([[:keyreq, :a], [:keyrest, :bl]], b.parameters, feature7701)
|
||||
assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {b.call(c: bug8139)}
|
||||
assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {b.call}
|
||||
|
||||
b = assert_nothing_raised(SyntaxError, feature7701) do
|
||||
break eval("proc {|m, a:| [m, a]}", nil, 'xyzzy', __LINE__)
|
||||
end
|
||||
assert_raise_with_message(ArgumentError, /missing keyword/) {b.call}
|
||||
assert_equal([:ok, 42], b.call(:ok, a: 42))
|
||||
e = assert_raise_with_message(ArgumentError, /unknown keyword/) {b.call(42, a:0, b:1)}
|
||||
assert_equal('xyzzy', e.backtrace_locations[0].path)
|
||||
assert_equal([[:opt, :m], [:keyreq, :a]], b.parameters)
|
||||
end
|
||||
|
||||
def test_super_with_keyword
|
||||
|
|
Загрузка…
Ссылка в новой задаче