On Sep 2, 2006, at 6:34 PM, Nathaniel Talbott wrote:

> On 9/1/06, Tanaka Akira <akr / fsij.org> wrote:
>
>> How about this patch?
>>
>> Index: lib/test/unit/testcase.rb
>
> I'm fine with this - I just wish I could remember why I limited it the
> way I did. I guess we'll just chalk it up to newbism.
>
> Does anyone see this breaking existing code?

I think Interrupt should be re-raised.  If a user wants to explicitly  
test for ^C behavior they can catch it themselves.

$ cat test.rb
require 'test/unit'

class TestTest < Test::Unit::TestCase

   def test_0; sleep; end
   def test_1; sleep; end
   def test_2; sleep; end
   def test_3; sleep; end
   def test_4; sleep; end
   def test_5; sleep; end
   def test_6; sleep; end
   def test_7; sleep; end
   def test_8; sleep; end
   def test_9; sleep; end
   def test_a; sleep; end
   def test_b; sleep; end
   def test_c; sleep; end
   def test_d; sleep; end
   def test_e; sleep; end

end
$ ruby19 -Ilib test.rb
Loaded suite test
Started
^CE^CE^CE^CE^CE^CE^CE^CE^CE^CE^CE^CE^CE^CE^CE
Finished in 4.946166 seconds.

for more tests this would be more annoying:

456 tests, 1039 assertions, 8 failures, 6 errors


Index: lib/test/unit/testcase.rb
===================================================================
RCS file: /src/ruby/lib/test/unit/testcase.rb,v
retrieving revision 1.7
diff -p -u -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 04:19:58 -0000
@@ -70,14 +70,16 @@ module Test
            __send__(@method_name)
          rescue AssertionFailedError => e
            add_failure(e.message, e.backtrace)
-        rescue StandardError, ScriptError
+        rescue Exception
+          raise if Interrupt === $!
            add_error($!)
          ensure
            begin
              teardown
            rescue AssertionFailedError => e
              add_failure(e.message, e.backtrace)
-          rescue StandardError, ScriptError
+          rescue Exception
+            raise if Interrupt === $!
              add_error($!)
            end
          end



-- 
Eric Hodel - drbrain / segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com