From fa63897c6683d7e3db60b37fca787dc796a92676 Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 19 Oct 2008 15:59:35 +0000 Subject: * lib/test/unit.rb (Test::Unit.setup_argv): call given block for filtering files. * test/runner.rb: search srcdir/test/arg, srcdir/arg. * bin/testrb: show usage if no files given. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/runner.rb | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/runner.rb b/test/runner.rb index c8a06e1dd..aa7a5f8ba 100644 --- a/test/runner.rb +++ b/test/runner.rb @@ -2,4 +2,24 @@ require 'rbconfig' exit if CROSS_COMPILING require 'test/unit' -Test::Unit.setup_argv + +src_testdir = File.dirname(File.expand_path(__FILE__)) +srcdir = File.dirname(src_testdir) + +Test::Unit.setup_argv {|files| + if files.empty? + [src_testdir] + else + files.map {|f| + if File.exist? f + f + elsif File.exist? "#{src_testdir}/#{f}" + "#{src_testdir}/#{f}" + elsif File.exist? "#{srcdir}/#{f}" + "#{srcdir}/#{f}" + else + raise ArgumentError, "not found: #{f}" + end + } + end +} -- cgit