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

ruby-changes:7996

From: ryan <ko1@a...>
Date: Wed, 24 Sep 2008 17:20:26 +0900 (JST)
Subject: [ruby-changes:7996] Ruby:r19520 (trunk): Added ARGV filtering for tests. Allows for multiple values

ryan	2008-09-24 17:19:12 +0900 (Wed, 24 Sep 2008)

  New Revision: 19520

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19520

  Log:
    Added ARGV filtering for tests. Allows for multiple values

  Modified files:
    trunk/test/runner.rb

Index: test/runner.rb
===================================================================
--- test/runner.rb	(revision 19519)
+++ test/runner.rb	(revision 19520)
@@ -6,15 +6,22 @@
 Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze
 Release = rcsid[3].freeze
 
-# not sure why these are needed now... but whatever
-$:.push(*Dir["test/*"].find_all { |path| File.directory? path })
-
 class Module
   def tu_deprecation_warning old, new = nil, kaller = nil
     # stfu - for now...
   end
 end
 
-(Dir["test/test_*.rb"] + Dir["test/**/test_*.rb"]).each do |test|
+test_dir = File.dirname(__FILE__)
+
+# not sure why these are needed now... but whatever
+$:.push(*Dir[File.join(test_dir, '*')].find_all { |path| File.directory? path })
+
+test_files = (Dir[File.join(test_dir, "test_*.rb")] +
+              Dir[File.join(test_dir, "**/test_*.rb")])
+
+test_files = test_files.grep(Regexp.union(*ARGV)) unless ARGV.empty?
+
+test_files.each do |test|
   require test
 end

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

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