In article <87ac5hv4bo.fsf / fsij.org>,
  Tanaka Akira <akr / fsij.org> writes:

> Oops.  It seems that the class hierarchy is not appropriate
> to classify them for unit test.

I investigated the class hierarchy on second thought.

* Exception
  * NoMemoryError
  * ScriptError
  * SignalException
    * Interrupt
      * Timeout::Error
  * StandardError
  * SystemExit

Now I think NoMemoryError, SignalException, Interrupt,
SystemExit should terminate the test runner.

* NoMemoryError is too dangerous.  I think it is better to
  reduce memory consumption by terminating the process.

* SignalException and Interrupt should terminate the test
  runner because it may be caused by the user.

* SystemExit is caused by exit.  If exit is called
  explicitly, I have no reason to prevent it.

So I think Exception, ScriptError, StandardError and all
non-builtin exceptions should be caught.

Index: lib/test/unit/testcase.rb
===================================================================
RCS file: /src/ruby/lib/test/unit/testcase.rb,v
retrieving revision 1.7
diff -u -p -r1.7 testcase.rb
--- lib/test/unit/testcase.rb	4 Aug 2006 18:05:45 -0000	1.7
+++ lib/test/unit/testcase.rb	3 Sep 2006 15:20:18 -0000
@@ -70,7 +70,8 @@ module Test
           __send__(@method_name)
         rescue AssertionFailedError => e
           add_failure(e.message, e.backtrace)
-        rescue StandardError, ScriptError
+        rescue Exception
+          raise if [NoMemoryError, SignalException, Interrupt, SystemExit].include? $!.class
           add_error($!)
         ensure
           begin
-- 
Tanaka Akira