mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/test/unit.rb: make test/unit play nicely with the rake test
loader. [ruby-core:32864] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4e3fda080c
commit
8a40d614a3
2 changed files with 38 additions and 32 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Oct 24 12:08:54 2010 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
|
* lib/test/unit.rb: make test/unit play nicely with the rake test
|
||||||
|
loader. [ruby-core:32864]
|
||||||
|
|
||||||
Sun Oct 24 00:25:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Oct 24 00:25:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* test/ruby/test_rubyoptions.rb (test_segv_test): follow up the
|
* test/ruby/test_rubyoptions.rb (test_segv_test): follow up the
|
||||||
|
|
|
@ -70,17 +70,6 @@ module Test
|
||||||
end
|
end
|
||||||
|
|
||||||
def non_options(files, options)
|
def non_options(files, options)
|
||||||
files.each {|f|
|
|
||||||
d = File.dirname(path = File.expand_path(f))
|
|
||||||
unless $:.include? d
|
|
||||||
$: << d
|
|
||||||
end
|
|
||||||
begin
|
|
||||||
require path
|
|
||||||
rescue LoadError
|
|
||||||
puts "#{f}: #{$!}"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -133,35 +122,47 @@ module Test
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module RequireFiles
|
||||||
|
def non_options(files, options)
|
||||||
|
super
|
||||||
|
files.each {|f|
|
||||||
|
d = File.dirname(path = File.expand_path(f))
|
||||||
|
unless $:.include? d
|
||||||
|
$: << d
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
require path
|
||||||
|
rescue LoadError
|
||||||
|
puts "#{f}: #{$!}"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.new(*args, &block)
|
def self.new(*args, &block)
|
||||||
|
Mini.class_eval do
|
||||||
|
include Test::Unit::RequireFiles
|
||||||
|
end
|
||||||
Mini.new(*args, &block)
|
Mini.new(*args, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
class Mini < MiniTest::Unit
|
class Mini < MiniTest::Unit
|
||||||
include Test::Unit::GlobOption
|
include Test::Unit::GlobOption
|
||||||
include Test::Unit::LoadPathOption
|
include Test::Unit::LoadPathOption
|
||||||
|
include Test::Unit::RunCount
|
||||||
|
include Test::Unit::Options
|
||||||
|
|
||||||
|
class << self; undef autorun; end
|
||||||
|
def self.autorun
|
||||||
|
at_exit {
|
||||||
|
Test::Unit::RunCount.run_once {
|
||||||
|
exit(Test::Unit::Mini.new.run(ARGV) || true)
|
||||||
|
}
|
||||||
|
} unless @@installed_at_exit
|
||||||
|
@@installed_at_exit = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class MiniTest::Unit
|
Test::Unit::Mini.autorun
|
||||||
def self.new(*args, &block)
|
|
||||||
obj = allocate
|
|
||||||
.extend(Test::Unit::RunCount)
|
|
||||||
.extend(Test::Unit::Options)
|
|
||||||
obj.__send__(:initialize, *args, &block)
|
|
||||||
obj
|
|
||||||
end
|
|
||||||
|
|
||||||
class << self; undef autorun; end
|
|
||||||
def self.autorun
|
|
||||||
at_exit {
|
|
||||||
Test::Unit::RunCount.run_once {
|
|
||||||
exit(Test::Unit::Mini.new.run(ARGV) || true)
|
|
||||||
}
|
|
||||||
} unless @@installed_at_exit
|
|
||||||
@@installed_at_exit = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
MiniTest::Unit.autorun
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue