[#28687] [Bug #2973] rb_bug - Segmentation fault - error.c:213 — rudolf gavlas <redmine@...>

Bug #2973: rb_bug - Segmentation fault - error.c:213

10 messages 2010/03/16

[#28735] [Bug #2982] Ruby tries to link with both openssl and readline — Lucas Nussbaum <redmine@...>

Bug #2982: Ruby tries to link with both openssl and readline

16 messages 2010/03/18

[#28736] [Bug #2983] Ruby (GPLv2 only) tries to link to with readline (now GPLv3) — Lucas Nussbaum <redmine@...>

Bug #2983: Ruby (GPLv2 only) tries to link to with readline (now GPLv3)

10 messages 2010/03/18

[#28907] [Bug #3000] Open SSL Segfaults — Christian Höltje <redmine@...>

Bug #3000: Open SSL Segfaults

19 messages 2010/03/23

[#28924] [Bug #3005] Ruby core dump - [BUG] rb_sys_fail() - errno == 0 — Sebastian YEPES <redmine@...>

Bug #3005: Ruby core dump - [BUG] rb_sys_fail() - errno == 0

10 messages 2010/03/24

[#28954] [Feature #3010] slow require gems in ruby 1.9.1 — Miao Jiang <redmine@...>

Feature #3010: slow require gems in ruby 1.9.1

15 messages 2010/03/24

[#29179] [Bug #3071] Convert rubygems and rdoc to use psych — Aaron Patterson <redmine@...>

Bug #3071: Convert rubygems and rdoc to use psych

10 messages 2010/03/31

[ruby-core:28854] [Feature #1599] ruby test_foo.rb --help do not show help message

From: Yusuke Endoh <redmine@...>
Date: 2010-03-22 03:00:51 UTC
List: ruby-core #28854
Issue #1599 has been updated by Yusuke Endoh.

Assigned to changed from Yukihiro Matsumoto to Ryan Davis

Hi,

> I execute below command.
> I think it shows help messages, but execute tests only.
>
> $ ruby test_foo.rb --help
>
> For convenience, I want it to show help messages.


Ryan, what do you think about this feature request?


diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb
index 1570b7f..67b789a 100644
--- a/lib/minitest/unit.rb
+++ b/lib/minitest/unit.rb
@@ -383,15 +383,25 @@ module MiniTest
     # Top level driver, controls all output and filtering.
 
     def run args = []
-      @verbose = args.delete('-v')
-
-      filter = if args.first =~ /^(-n|--name)$/ then
-                 args.shift
-                 arg = args.shift
-                 arg =~ /\/(.*)\// ? Regexp.new($1) : arg
-               else
-                 /./ # anything - ^test_ already filtered by #tests
-               end
+      @verbose = false
+
+      filter = /./
+      while arg = args.shift
+        case arg
+        when "-v"
+          @verbose = true
+        when "-n", "--name"
+          arg = args.shift
+          filter =~ /\/(.*)\// ? Regexp.new($1) : arg
+        when "-h", "--help"
+          puts <<END
+usage: ruby #{ $0 }
+  -v                   verbose mode
+  -n, --name PATTERN   filter tests by PATTERN (which is a Regexp or String)
+END
+          exit
+        end
+      end
 
       @@out.puts "Loaded suite #{$0.sub(/\.rb$/, '')}\nStarted"
 

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1599

----------------------------------------
http://redmine.ruby-lang.org

In This Thread