summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-12 01:13:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-12 01:13:40 +0000
commitb19f3a8a1592bf32bd83e02c433715cd67923d1d (patch)
tree1d2f04bd5207326222892ef3e883c846b5dce21e /test
parent90b7ddb89fb5625df1292e766604372ddf26ada1 (diff)
* eval_jump.c (rb_exec_end_proc): remember the latest exit status.
[ruby-core:43173][Bug #5218] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_beginendblock.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb
index 18649ffbd4..7172aec4e1 100644
--- a/test/ruby/test_beginendblock.rb
+++ b/test/ruby/test_beginendblock.rb
@@ -148,4 +148,17 @@ EOW
assert_in_out_err(t.path, "", expected, [], "[ruby-core:35237]")
t.close
end
+
+ def test_rescue_at_exit
+ bug5218 = '[ruby-core:43173][Bug #5218]'
+ cmd = [
+ "raise 'X' rescue nil",
+ "nil",
+ "exit(42)",
+ ]
+ %w[at_exit END].each do |ex|
+ out, err, status = EnvUtil.invoke_ruby(cmd.map {|s|["-e", "#{ex} {#{s}}"]}.flatten, "", true, true)
+ assert_equal(["", "", 42], [out, err, status.exitstatus], "#{bug5218}: #{ex}")
+ end
+ end
end