mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/test/unit.rb (Test::Unit.setup_argv): run tests only when
any tests have not run. * bin/testrb, test/runner.rb: use Test::Unit.start. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
adf37e2fde
commit
96863dc358
4 changed files with 42 additions and 7 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
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
|
||||||
|
any tests have not run.
|
||||||
|
|
||||||
|
* bin/testrb, test/runner.rb: use Test::Unit.start.
|
||||||
|
|
||||||
Fri Jul 16 12:06:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Jul 16 12:06:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* tool/rbinstall.rb (ext-arch): prune directories start with '-'.
|
* tool/rbinstall.rb (ext-arch): prune directories start with '-'.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
Test::Unit.setup_argv {|files|
|
exit Test::Unit.start {|files|
|
||||||
if files.empty?
|
if files.empty?
|
||||||
puts "Usage: testrb [options] tests..."
|
puts "Usage: testrb [options] tests..."
|
||||||
exit 1
|
exit false
|
||||||
end
|
end
|
||||||
if files.size == 1
|
if files.size == 1
|
||||||
$0 = File.basename(files[0])
|
$0 = File.basename(files[0])
|
||||||
|
|
|
@ -9,7 +9,21 @@ module Test
|
||||||
module Unit
|
module Unit
|
||||||
TEST_UNIT_IMPLEMENTATION = 'test/unit compatibility layer using minitest'
|
TEST_UNIT_IMPLEMENTATION = 'test/unit compatibility layer using minitest'
|
||||||
|
|
||||||
def self.setup_argv(original_argv=ARGV)
|
@@installed_at_exit = true
|
||||||
|
@@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 = []
|
||||||
|
@ -67,9 +81,23 @@ module Test
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
ARGV.replace minitest_argv
|
at_exit {
|
||||||
|
next if @@run_count.nonzero?
|
||||||
|
next if $! # don't run if there was an exception
|
||||||
|
exit false unless run(minitest_argv)
|
||||||
|
} unless @@installed_at_exit
|
||||||
|
@@installed_at_exit = true
|
||||||
|
|
||||||
|
minitest_argv
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.run(args)
|
||||||
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
MiniTest::Unit.autorun
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
Test::Unit.setup_argv {|files|
|
exit Test::Unit.start {|files|
|
||||||
if files.empty?
|
if files.empty?
|
||||||
[src_testdir]
|
[src_testdir]
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue