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

test_exception.rb: missing test

* test/ruby/test_exception.rb (test_name_error_info): add missing
  test of NoMethodError and NameError.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-11-18 15:11:03 +00:00
parent 714fd78f67
commit 5cf688a588

View file

@ -656,4 +656,21 @@ end.join
def test_anonymous_message
assert_in_out_err([], "raise Class.new(RuntimeError), 'foo'", [], /foo\n/)
end
def test_name_error_info
obj = BasicObject.new
e = assert_raise(NameError) {
obj.instance_eval("Object")
}
assert_equal(:Object, e.name)
e = assert_raise(NameError) {
obj.instance_eval {foo}
}
assert_equal(:foo, e.name)
e = assert_raise(NoMethodError) {
obj.foo(1, 2)
}
assert_equal(:foo, e.name)
assert_equal([1, 2], e.args)
end
end