From 5383964f98659ea0cd371d77b9ed97f46702e591 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 24 Oct 2010 06:16:36 +0000 Subject: [PATCH] * lib/test/unit.rb (Test::Unit::Mini#run): abort if interrupted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 +++- lib/test/unit.rb | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 31d804f5e6..29bfefb8e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ -Sun Oct 24 14:17:58 2010 Nobuyoshi Nakada +Sun Oct 24 15:16:30 2010 Nobuyoshi Nakada + + * lib/test/unit.rb (Test::Unit::Mini#run): abort if interrupted. * lib/test/unit.rb (Test::Unit::Mini#run_test_suites): show the result even when interrupted on the way. diff --git a/lib/test/unit.rb b/lib/test/unit.rb index f7e7246198..87c9d1b022 100644 --- a/lib/test/unit.rb +++ b/lib/test/unit.rb @@ -162,10 +162,18 @@ module Test @@installed_at_exit = true end + def run(*args) + result = super + abort if @interrupt + result + end + def run_test_suites(*args) old_sync = @@out.sync if @@out.respond_to?(:sync=) + @interrupt = false super rescue Interrupt + @interrupt = true [@test_count, @assertion_count] ensure @@out.sync = old_sync if @@out.respond_to?(:sync=)