From 95256bcf973bfb5a5264e31d2764d1b2ab6e6abe Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 23 Oct 2018 14:26:23 +0000 Subject: 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 --- test/lib/test/unit.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test/lib') 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 -- cgit v1.2.3