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:
parent
04196d1f8c
commit
7dddd592d1
1 changed files with 19 additions and 13 deletions
|
@ -857,26 +857,32 @@ module Test
|
|||
end
|
||||
end
|
||||
|
||||
def self.load(dir, name)
|
||||
return unless dir and name
|
||||
path = File.join(dir, name.gsub(/::/, '/') + ".rb")
|
||||
begin
|
||||
src = File.read(path)
|
||||
rescue Errno::ENOENT
|
||||
nil
|
||||
else
|
||||
instance = new({})
|
||||
instance.instance_eval(src)
|
||||
instance
|
||||
def self.load(dirs, name)
|
||||
return unless dirs and name
|
||||
instance = nil
|
||||
dirs.each do |dir|
|
||||
path = File.join(dir, name.gsub(/::/, '/') + ".rb")
|
||||
begin
|
||||
src = File.read(path)
|
||||
rescue Errno::ENOENT
|
||||
nil
|
||||
else
|
||||
instance ||= new({})
|
||||
instance.instance_eval(src)
|
||||
end
|
||||
end
|
||||
instance
|
||||
end
|
||||
end
|
||||
|
||||
def setup_options(parser, options)
|
||||
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|
|
||||
options[:excludes] = d
|
||||
options[:excludes].concat d.split(File::PATH_SEPARATOR)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue