aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_exception.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-23 05:49:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-23 05:49:43 +0000
commitc20a1946a6d7b260f1f0f3038b7af081174d6cd9 (patch)
treee62af298aac15c9fc3c4a5a7bb087c08201ec225 /test/ruby/test_exception.rb
parent9777547817c775cb2e767083385090dd79f77fff (diff)
downloadruby-c20a1946a6d7b260f1f0f3038b7af081174d6cd9.tar.gz
Restrict cause to an exception object [Bug #15447]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r--test/ruby/test_exception.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 0f2511a386..a868279de8 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -808,7 +808,7 @@ end.join
e = assert_raise(exc, bug) {raise exc, "foo" => "bar", foo: "bar"}
assert_equal({"foo" => "bar", foo: "bar"}, e.arg, bug)
- e = assert_raise(exc, bug) {raise exc, "foo" => "bar", foo: "bar", cause: "zzz"}
+ e = assert_raise(exc, bug) {raise exc, "foo" => "bar", foo: "bar", cause: RuntimeError.new("zzz")}
assert_equal({"foo" => "bar", foo: "bar"}, e.arg, bug)
e = assert_raise(exc, bug) {raise exc, {}}
@@ -1346,11 +1346,9 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
end
def test_non_exception_cause
- code = "#{<<~"begin;"}\n#{<<~'end;'}"
- begin;
+ assert_raise_with_message(TypeError, /exception/) do
raise "foo", cause: 1
end;
- assert_in_out_err([], code, [], /foo/, success: false, timeout: 2)
end
def test_circular_cause_handle