aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-24 03:11:20 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-24 03:11:20 +0000
commit8a40d614a3aca6e1ef0c2fec439bf6661466f282 (patch)
tree641a9df2ba29544707ab736a29d88abcff671799 /lib
parent4e3fda080c9186193e1fcc9c843d05f995629c2d (diff)
downloadruby-8a40d614a3aca6e1ef0c2fec439bf6661466f282.tar.gz
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/test/unit.rb65
1 files changed, 33 insertions, 32 deletions
diff --git a/lib/test/unit.rb b/lib/test/unit.rb
index 74ac201c4b..f722205fa4 100644
--- a/lib/test/unit.rb
+++ b/lib/test/unit.rb
@@ -70,17 +70,6 @@ module Test
end
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
@@ -133,35 +122,47 @@ module Test
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)
+ Mini.class_eval do
+ include Test::Unit::RequireFiles
+ end
Mini.new(*args, &block)
end
class Mini < MiniTest::Unit
include Test::Unit::GlobOption
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
-class MiniTest::Unit
- 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
+Test::Unit::Mini.autorun