mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 00:54:01 +02:00
error.c(exc_full_message): Exception#full_message
Add a method to retrieve a String expression of an exception, formatted in the same way that Ruby prints an uncaught exception out. [Feature #14141] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
838f23ae34
commit
0d7718896c
4 changed files with 109 additions and 53 deletions
|
@ -1094,4 +1094,15 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
}
|
||||
end;
|
||||
end
|
||||
|
||||
def test_full_message
|
||||
test_method = "def foo; raise 'testerror'; end"
|
||||
|
||||
out1, err1, status1 = EnvUtil.invoke_ruby(['-e', "#{test_method}; begin; foo; rescue => e; puts e.full_message; end"], '', true, true)
|
||||
assert(status1.success?)
|
||||
assert(err1.empty?, "expected nothing wrote to $stdout by #long_message")
|
||||
|
||||
_, err2, status1 = EnvUtil.invoke_ruby(['-e', "#{test_method}; begin; foo; end"], '', true, true)
|
||||
assert_equal(err2, out1)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue