1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_keyword.rb: assert_raise_with_message value

* test/ruby/test_keyword.rb (test_block_required_keyword):
  assert_raise_with_message returns the raised exception object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-11-29 03:06:02 +00:00
parent 07fb750fd0
commit a65982f00f

View file

@ -371,12 +371,8 @@ class TestKeywordArguments < Test::Unit::TestCase
break eval("proc {|a:| a}", nil, 'xyzzy', __LINE__)
end
assert_raise_with_message(ArgumentError, /missing keyword/, feature7701) {b.call}
assert_raise_with_message(ArgumentError, /unknown keyword/, feature7701) {b.call(a:0, b:1)}
begin
b.call(a: 0, b: 1)
rescue => e
e = assert_raise_with_message(ArgumentError, /unknown keyword/, feature7701) {b.call(a:0, b:1)}
assert_equal('xyzzy', e.backtrace_locations[0].path)
end
assert_equal(42, b.call(a: 42), feature7701)
assert_equal([[:keyreq, :a]], b.parameters, feature7701)