* lib/test/unit.rb, bin/testrb, test/runner.rb: revert r28655, which
broke test-all. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
048d2e6d32
commit
d98d3fe12a
@ -1,3 +1,8 @@
|
|||||||
|
Fri Jul 16 22:08:10 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* lib/test/unit.rb, bin/testrb, test/runner.rb: revert r28655, which
|
||||||
|
broke test-all.
|
||||||
|
|
||||||
Fri Jul 16 14:58:38 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Jul 16 14:58:38 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/test/unit.rb (Test::Unit.setup_argv): run tests only when
|
* lib/test/unit.rb (Test::Unit.setup_argv): run tests only when
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
exit Test::Unit.start {|files|
|
Test::Unit.setup_argv {|files|
|
||||||
if files.empty?
|
if files.empty?
|
||||||
puts "Usage: testrb [options] tests..."
|
puts "Usage: testrb [options] tests..."
|
||||||
exit false
|
exit 1
|
||||||
end
|
end
|
||||||
if files.size == 1
|
if files.size == 1
|
||||||
$0 = File.basename(files[0])
|
$0 = File.basename(files[0])
|
||||||
|
@ -9,21 +9,7 @@ module Test
|
|||||||
module Unit
|
module Unit
|
||||||
TEST_UNIT_IMPLEMENTATION = 'test/unit compatibility layer using minitest'
|
TEST_UNIT_IMPLEMENTATION = 'test/unit compatibility layer using minitest'
|
||||||
|
|
||||||
@@installed_at_exit = true
|
def self.setup_argv(original_argv=ARGV)
|
||||||
@@run_count = 0
|
|
||||||
|
|
||||||
RunCount = Module.new do
|
|
||||||
def run(*)
|
|
||||||
@@run_count += 1
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.new(*)
|
|
||||||
super.extend(RunCount)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.setup_argv(original_argv=::ARGV)
|
|
||||||
minitest_argv = []
|
minitest_argv = []
|
||||||
files = []
|
files = []
|
||||||
reject = []
|
reject = []
|
||||||
@ -81,23 +67,9 @@ module Test
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
at_exit {
|
ARGV.replace minitest_argv
|
||||||
next if @@run_count.nonzero?
|
end
|
||||||
next if $! # don't run if there was an exception
|
end
|
||||||
exit false unless run(minitest_argv)
|
|
||||||
} unless @@installed_at_exit
|
|
||||||
@@installed_at_exit = true
|
|
||||||
|
|
||||||
minitest_argv
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.run(args)
|
MiniTest::Unit.autorun
|
||||||
exit_code = MiniTest::Unit.new.run(args)
|
|
||||||
!exit_code || exit_code == 0
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.start(argv=::ARGV, &block)
|
|
||||||
run(setup_argv(argv, &block))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
@ -6,7 +6,7 @@ require 'test/unit'
|
|||||||
src_testdir = File.dirname(File.expand_path(__FILE__))
|
src_testdir = File.dirname(File.expand_path(__FILE__))
|
||||||
srcdir = File.dirname(src_testdir)
|
srcdir = File.dirname(src_testdir)
|
||||||
|
|
||||||
exit Test::Unit.start {|files|
|
Test::Unit.setup_argv {|files|
|
||||||
if files.empty?
|
if files.empty?
|
||||||
[src_testdir]
|
[src_testdir]
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user