Project

General

Profile

Feature #1599

ruby test_foo.rb --help do not show help message

Added by okkez (okkez _) over 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-core:23793]

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

History

#1

Updated by godfat (Lin Jen-Shin) over 10 years ago

=begin
Then what should this produce?

$ ruby which gem --help
=end

#2

Updated by rogerdpack (Roger Pack) over 10 years ago

=begin
+1
having mini test tests output help information would be great.
-=r
=end

#3

Updated by akr (Akira Tanaka) over 10 years ago

=begin
help message with --help is good.

But don't use optparse to keeptest system small.
=end

#4

Updated by yugui (Yuki Sonoda) over 10 years ago

  • Assignee set to matz (Yukihiro Matsumoto)

=begin

=end

#5

Updated by mame (Yusuke Endoh) almost 10 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

#6

Updated by zenspider (Ryan Davis) almost 10 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

#7

Updated by yugui (Yuki Sonoda) almost 10 years ago

  • Status changed from Open to Closed

=begin

=end

Also available in: Atom PDF