Skip to content

Commit 420d98e

Browse files
committed
* 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
1 parent 7f46fad commit 420d98e

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

ChangeLog

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
Sun Feb 13 00:29:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* lib/test/unit.rb (Test::Unit::Options#process_args): always
4+
return options.
5+
6+
* lib/test/unit.rb (Test::Unit::RequireFiles#non_options): return
7+
if any test case get loaded.
8+
9+
* lib/test/unit.rb (Test::Unit::AutoRunner#initialize): do not add
10+
default directory if it is nil.
11+
12+
* lib/test/unit.rb (Test::Unit::AutoRunner#process_args): return
13+
true if any test cases to run.
14+
115
Sat Feb 12 23:17:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
216

317
* lib/test/unit.rb (assert_include): add alias.

bin/testrb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ tests.options.banner.sub!(/\[options\]/, '\& tests...')
55
unless tests.process_args(ARGV)
66
abort tests.options.banner
77
end
8-
p files = tests.to_run
8+
files = tests.to_run
99
$0 = files.size == 1 ? File.basename(files[0]) : files.to_s
1010
exit tests.run

lib/test/unit.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def process_args(args = [])
4848
opts.parse!(args)
4949
orig_args -= args
5050
args = @init_hook.call(args, options) if @init_hook
51-
non_options(args, options) or return nil
51+
non_options(args, options)
5252
@help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " "
5353
@options = options
5454
end
@@ -167,18 +167,21 @@ def non_options(files, options)
167167

168168
module RequireFiles
169169
def non_options(files, options)
170-
return false if !super or files.empty?
170+
return false if !super
171+
result = false
171172
files.each {|f|
172173
d = File.dirname(path = File.expand_path(f))
173174
unless $:.include? d
174175
$: << d
175176
end
176177
begin
177178
require path
179+
result = true
178180
rescue LoadError
179181
puts "#{f}: #{$!}"
180182
end
181183
}
184+
result
182185
end
183186
end
184187

@@ -227,7 +230,7 @@ class AutoRunner
227230
def initialize(force_standalone = false, default_dir = nil, argv = ARGV)
228231
@runner = Runner.new do |files, options|
229232
options[:base_directory] ||= default_dir
230-
files << default_dir if files.empty?
233+
files << default_dir if files.empty? and default_dir
231234
@to_run = files
232235
yield self if block_given?
233236
files
@@ -238,6 +241,7 @@ def initialize(force_standalone = false, default_dir = nil, argv = ARGV)
238241

239242
def process_args(*args)
240243
@runner.process_args(*args)
244+
!@to_run.empty?
241245
end
242246

243247
def run

0 commit comments

Comments
 (0)