summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-22 14:41:37 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-22 14:41:37 +0000
commit0ff424bc3ca851ad4bbb71b7e552d24db60221f6 (patch)
tree48c8c0b68c06a7e7dd8b643c6f815c24d8950bd0 /test
parent08871bb9195f30e9b191e555df68c069a5f8d4dd (diff)
downloadruby-0ff424bc3ca851ad4bbb71b7e552d24db60221f6.tar.gz
ruby-0ff424bc3ca851ad4bbb71b7e552d24db60221f6.tar.xz
ruby-0ff424bc3ca851ad4bbb71b7e552d24db60221f6.zip
merge -c 12126
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6@12309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_beginendblock.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb
index b56b596a6..4ac8de10f 100644
--- a/test/ruby/test_beginendblock.rb
+++ b/test/ruby/test_beginendblock.rb
@@ -54,4 +54,34 @@ EOW
assert_equal(expected, File.read(erroutpath))
# expecting Tempfile to unlink launcher and errout file.
end
+
+ def test_raise_in_at_exit
+ # [ruby-core:09675]
+ ruby = EnvUtil.rubybin
+ out = IO.popen("#{q(ruby)} -e 'STDERR.reopen(STDOUT);" \
+ "at_exit{raise %[SomethingBad]};" \
+ "raise %[SomethingElse]'") {|f|
+ f.read
+ }
+ assert_match /SomethingBad/, out
+ assert_match /SomethingElse/, out
+ end
+
+ def test_should_propagate_exit_code
+ ruby = EnvUtil.rubybin
+ assert_equal false, system("#{q(ruby)} -e 'at_exit{exit 2}'")
+ assert_equal 2, $?.exitstatus
+ assert_nil $?.termsig
+ end
+
+ def test_should_propagate_signaled
+ ruby = EnvUtil.rubybin
+ out = IO.popen("#{q(ruby)} -e 'STDERR.reopen(STDOUT);" \
+ "at_exit{Process.kill(:INT, $$)}'"){|f|
+ f.read
+ }
+ assert_match /Interrupt$/, out
+ assert_nil $?.exitstatus
+ assert_equal Signal.list["INT"], $?.termsig
+ end
end