1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/test/unit.rb (Test::Unit::GCStressOption): --gc-stress

option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-12-01 22:20:23 +00:00
parent 64740adcff
commit 5f37d6902a
2 changed files with 31 additions and 1 deletions

View file

@ -1,4 +1,7 @@
Thu Dec 2 07:15:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
Thu Dec 2 07:20:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit.rb (Test::Unit::GCStressOption): --gc-stress
option.
* lib/test/unit.rb (Test::Unit::Mini#_run_suites): show the result
even when interrupted on the way.

View file

@ -123,6 +123,32 @@ module Test
end
end
module GCStressOption
def setup_options(parser, options)
super
parser.on '--[no-]gc-stress' do |flag|
options[:gc_stress] = flag
end
end
def non_options(files, options)
if options.delete(:gc_stress)
MiniTest::Unit::TestCase.class_eval do
oldrun = instance_method(:run)
define_method(:run) do |runner|
begin
gc_stress, GC.stress = GC.stress, true
oldrun.bind(self).call(runner)
ensure
GC.stress = gc_stress
end
end
end
end
super
end
end
module RequireFiles
def non_options(files, options)
super
@ -150,6 +176,7 @@ module Test
class Mini < MiniTest::Unit
include Test::Unit::GlobOption
include Test::Unit::LoadPathOption
include Test::Unit::GCStressOption
include Test::Unit::RunCount
include Test::Unit::Options