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

test/unit.rb: glob w/o prefix/suffix

* test/lib/test/unit.rb (Test::Unit::GlobOption#non_options): glob
  the given pattern as-is under the TESTSDIR without the prefix
  nor the suffix, when it has separator(s) but does not end with a
  separator nor is not a directory.  e.g.:

      make test-all TESTS='ruby/test_time*'

  runs `ruby/test_time.rb` and `ruby/test_time_tz.rb` only, like
  as the following:

      make test-all TESTS='$(TESTSDIR)/ruby/test_time*'

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-10-23 14:26:23 +00:00
parent f7add52f8f
commit 95256bcf97

View file

@ -892,10 +892,15 @@ module Test
next if f.empty?
path = f
end
if !(match = (Dir["#{path}/**/#{@@testfile_prefix}_*.rb"] + Dir["#{path}/**/*_#{@@testfile_suffix}.rb"]).uniq).empty?
if f.end_with?(File::SEPARATOR) or !f.include?(File::SEPARATOR) or File.directory?(path)
match = (Dir["#{path}/**/#{@@testfile_prefix}_*.rb"] + Dir["#{path}/**/*_#{@@testfile_suffix}.rb"]).uniq
else
match = Dir[path]
end
if !match.empty?
if reject
match.reject! {|n|
n[(prefix.length+1)..-1] if prefix
n = n[(prefix.length+1)..-1] if prefix
reject_pat =~ n
}
end