mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 00:54:01 +02:00
eval.c: copy before cause setup
* eval.c (setup_exception): copy frozen exception before setting up a cause not only a backtrace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e601e77590
commit
61ea519dc0
2 changed files with 22 additions and 11 deletions
|
@ -799,6 +799,13 @@ end.join
|
|||
assert_nil(orig_error.cause, bug13043)
|
||||
end
|
||||
|
||||
def test_cause_with_frozen_exception
|
||||
exc = ArgumentError.new("foo").freeze
|
||||
assert_raise_with_message(ArgumentError, exc.message) {
|
||||
raise exc, cause: RuntimeError.new("bar")
|
||||
}
|
||||
end
|
||||
|
||||
def test_anonymous_message
|
||||
assert_in_out_err([], "raise Class.new(RuntimeError), 'foo'", [], /foo\n/)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue