diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-23 14:26:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-23 14:26:23 +0000 |
commit | 95256bcf973bfb5a5264e31d2764d1b2ab6e6abe (patch) | |
tree | 2fd6bfcecd186108ecae7bdbe966e6af1bb04db6 | |
parent | f7add52f8f5bca11c1d0e2c95dd7c65333036d0f (diff) | |
download | ruby-95256bcf973bfb5a5264e31d2764d1b2ab6e6abe.tar.gz |
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
-rw-r--r-- | test/lib/test/unit.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb index 105a9a897d..3f74c7f5e2 100644 --- a/test/lib/test/unit.rb +++ b/test/lib/test/unit.rb @@ -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 |