Sha256: a025297cf34a90ca3ca671b84d899c89081596c1f86f1e73f52f4ae3a04606aa

Contents?: true

Size: 839 Bytes

Versions: 4

Compression:

Stored size: 839 Bytes

Contents

#!/usr/bin/env ruby
#
# Put script description here.
#
# Author::    
# Copyright:: 
# License::   Ruby
#

require 'Getopt/Declare'


require 'test/unit'
require "Getopt/Declare"

# to avoid getopt from exiting...
def exit(args)
end


class TC_Require < Test::Unit::TestCase

  def setup
    @args = Getopt::Declare.new(<<EOF, :build)
	-i <iterations:+i>	iteration count	
	-q	add new task [ requires: -i ]	
EOF
  end

  def test_q_without_i
    begin
      @args.parse('-q')
      assert_equal( nil, "Parsing of -q did not fail" )
    rescue
    end
  end

  def test_i_without_q
    begin
      @args.parse('-i 5')
    rescue
    end
    assert_equal( 5, @args['-i'] )
  end

  def test_i_with_q
    begin
      @args.parse('-i 5 -q')
    rescue
    end
    assert_equal( 5, @args['-i'] )
    assert_equal( '-q', @args['-q'] )
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
getopt-declare-1.31 test/test_cmdline_require.rb
getopt-declare-1.30 test/test_cmdline_require.rb
getopt-declare-1.29 test/test_cmdline_require.rb
getopt-declare-1.28 test/test_cmdline_require.rb