summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-09 05:14:40 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-09 05:14:40 +0000
commit32ba9eabf32ccca162987d461d916b06d1712ff1 (patch)
tree288931b33c3b7dcec6e572a62079d83158f5bcc7
parent74af63a39021bfbcae3c96605af9b9d542a6d517 (diff)
Rescue Exception in Test::Unit::TestCase#run. [ruby-core:08783]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/test/unit/testcase.rb12
2 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7361b54adb..925b009566 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Sep 9 14:08:38 2006 Eric Hodel <drbrain@segment7.net>
+
+ * lib/test/unit/testcase.rb (Test::Unit::TestCase#run): Rescue
+ Exception in Test::Unit::TestCase#run. [ruby-core:08783]
+
Sat Sep 9 04:55:59 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/pstore.rb: open all in binary mode, and get rid of the quirk of
diff --git a/lib/test/unit/testcase.rb b/lib/test/unit/testcase.rb
index b6bb420f96..0b8d235cd6 100644
--- a/lib/test/unit/testcase.rb
+++ b/lib/test/unit/testcase.rb
@@ -28,6 +28,12 @@ module Test
STARTED = name + "::STARTED"
FINISHED = name + "::FINISHED"
+ ##
+ # These exceptions are not caught by #run.
+
+ PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException, Interrupt,
+ SystemExit]
+
# Creates a new instance of the fixture for running the
# test represented by test_method_name.
def initialize(test_method_name)
@@ -72,14 +78,16 @@ module Test
__send__(@method_name)
rescue AssertionFailedError => e
add_failure(e.message, e.backtrace)
- rescue StandardError, ScriptError
+ rescue Exception
+ raise if PASSTHROUGH_EXCEPTIONS.include? $!.class
add_error($!)
ensure
begin
teardown
rescue AssertionFailedError => e
add_failure(e.message, e.backtrace)
- rescue StandardError, ScriptError
+ rescue Exception
+ raise if PASSTHROUGH_EXCEPTIONS.include? $!.class
add_error($!)
end
end