summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-12 15:29:24 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-12 15:29:24 +0000
commit420d98e4a8e4b1f11a7d30a94a43e65f689e7e74 (patch)
tree9c519d8521d4cab9b6cfd2fd817c27d7f3aab5bb /lib
parent7f46fadd9d7f8ee32d9837a67e212f55e23666b8 (diff)
* lib/test/unit.rb (Test::Unit::Options#process_args): always
return options. * lib/test/unit.rb (Test::Unit::RequireFiles#non_options): return if any test case get loaded. * lib/test/unit.rb (Test::Unit::AutoRunner#initialize): do not add default directory if it is nil. * lib/test/unit.rb (Test::Unit::AutoRunner#process_args): return true if any test cases to run. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/test/unit.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/test/unit.rb b/lib/test/unit.rb
index d079f47d42..fd50d8100d 100644
--- a/lib/test/unit.rb
+++ b/lib/test/unit.rb
@@ -48,7 +48,7 @@ module Test
opts.parse!(args)
orig_args -= args
args = @init_hook.call(args, options) if @init_hook
- non_options(args, options) or return nil
+ non_options(args, options)
@help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " "
@options = options
end
@@ -167,7 +167,8 @@ module Test
module RequireFiles
def non_options(files, options)
- return false if !super or files.empty?
+ return false if !super
+ result = false
files.each {|f|
d = File.dirname(path = File.expand_path(f))
unless $:.include? d
@@ -175,10 +176,12 @@ module Test
end
begin
require path
+ result = true
rescue LoadError
puts "#{f}: #{$!}"
end
}
+ result
end
end
@@ -227,7 +230,7 @@ module Test
def initialize(force_standalone = false, default_dir = nil, argv = ARGV)
@runner = Runner.new do |files, options|
options[:base_directory] ||= default_dir
- files << default_dir if files.empty?
+ files << default_dir if files.empty? and default_dir
@to_run = files
yield self if block_given?
files
@@ -238,6 +241,7 @@ module Test
def process_args(*args)
@runner.process_args(*args)
+ !@to_run.empty?
end
def run