[前][次][番号順一覧][スレッド一覧]

ruby-changes:53116

From: nobu <ko1@a...>
Date: Tue, 23 Oct 2018 23:26:29 +0900 (JST)
Subject: [ruby-changes:53116] nobu:r65330 (trunk): test/unit.rb: glob w/o prefix/suffix

nobu	2018-10-23 23:26:23 +0900 (Tue, 23 Oct 2018)

  New Revision: 65330

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65330

  Log:
    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*'

  Modified files:
    trunk/test/lib/test/unit.rb
Index: test/lib/test/unit.rb
===================================================================
--- test/lib/test/unit.rb	(revision 65329)
+++ test/lib/test/unit.rb	(revision 65330)
@@ -892,10 +892,15 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L892
               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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]