Project

General

Profile

Actions

Feature #1599

closed

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

Added by okkez (okkez _) about 13 years ago. Updated about 11 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

Actions #1

Updated by godfat (Lin Jen-Shin) about 13 years ago

=begin
Then what should this produce?

$ ruby which gem --help
=end

Actions #2

Updated by rogerdpack (Roger Pack) about 13 years ago

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

Actions #3

Updated by akr (Akira Tanaka) about 13 years ago

=begin
help message with --help is good.

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

Actions #4

Updated by yugui (Yuki Sonoda) almost 13 years ago

  • Assignee set to matz (Yukihiro Matsumoto)

=begin

=end

Actions #5

Updated by mame (Yusuke Endoh) over 12 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
=end

Actions #6

Updated by zenspider (Ryan Davis) about 12 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

Actions #7

Updated by yugui (Yuki Sonoda) about 12 years ago

  • Status changed from Open to Closed

=begin

=end

Actions

Also available in: Atom PDF