1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/unit.rb: --excludes-dir list

* test/lib/test/unit.rb (ExcludesOption): allow directory list by
  PATH_SEPARATOR to --excludes-dir option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-01-10 12:24:19 +00:00
parent 04196d1f8c
commit 7dddd592d1

View file

@ -857,26 +857,32 @@ module Test
end end
end end
def self.load(dir, name) def self.load(dirs, name)
return unless dir and name return unless dirs and name
instance = nil
dirs.each do |dir|
path = File.join(dir, name.gsub(/::/, '/') + ".rb") path = File.join(dir, name.gsub(/::/, '/') + ".rb")
begin begin
src = File.read(path) src = File.read(path)
rescue Errno::ENOENT rescue Errno::ENOENT
nil nil
else else
instance = new({}) instance ||= new({})
instance.instance_eval(src) instance.instance_eval(src)
instance
end end
end end
instance
end
end end
def setup_options(parser, options) def setup_options(parser, options)
super super
options[:excludes] = ENV["EXCLUDES"] if excludes = ENV["EXCLUDES"]
excludes = excludes.split(File::PATH_SEPARATOR)
end
options[:excludes] = excludes || []
parser.on '-X', '--excludes-dir DIRECTORY', "Directory name of exclude files" do |d| parser.on '-X', '--excludes-dir DIRECTORY', "Directory name of exclude files" do |d|
options[:excludes] = d options[:excludes].concat d.split(File::PATH_SEPARATOR)
end end
end end