summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 11:47:16 +0000
committersorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 11:47:16 +0000
commit0d7718896cfb629ad823b9ca5004465ef2063ab8 (patch)
tree764655a01a2038af09ef45f4ae5fbeb0ff31ce42 /test
parent838f23ae34a634f3bbe39d27b861abc8dd853762 (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_exception.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 3622cae0d9..da1cbd37cf 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -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