Feature #1599
closedruby test_foo.rb --help do not show help message
Description
=begin
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.
Why not use optparse library?¶
=end
Updated by godfat (Lin Jen-Shin) over 15 years ago
=begin
Then what should this produce?
$ ruby which gem
--help
=end
Updated by rogerdpack (Roger Pack) over 15 years ago
=begin
+1
having mini test tests output help information would be great.
-=r
=end
Updated by akr (Akira Tanaka) over 15 years ago
=begin
help message with --help is good.
But don't use optparse to keeptest system small.
=end
Updated by yugui (Yuki Sonoda) over 15 years ago
- Assignee set to matz (Yukihiro Matsumoto)
=begin
=end
Updated by mame (Yusuke Endoh) almost 15 years ago
- Assignee changed from matz (Yukihiro Matsumoto) to zenspider (Ryan Davis)
=begin
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
=end
Updated by zenspider (Ryan Davis) over 14 years ago
=begin
On Mar 21, 2010, at 20:00 , Yusuke Endoh wrote:
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?
Sorry I took so long to get back to you.
I've already implemented this in minitest w/ OptionParser. I just released minitest (and a bunch of other stuff) and also imported it into ruby-trunk.
Thanks
=end