Sha256: 773f4dc591ae858a1b022f850bcd7894c34bf6956cefb89305c89aa40fdd242e

Contents?: true

Size: 576 Bytes

Versions: 1

Compression:

Stored size: 576 Bytes

Contents

require File.expand_path 'test_helper', File.dirname(__FILE__)

class TestArgsParserDefault < MiniTest::Unit::TestCase
  def setup
    @argv = ['--age', '40']
    @parser = ArgsParser.parse @argv do
      arg :name, 'use name', :default => 'shokai'
      arg :age, 'age', :default => 14
      arg :time, 'time', :default => lambda{ Time.now }
    end
  end

  def test_default
    assert @parser[:name] == 'shokai'
  end

  def test_overwrite
    assert @parser[:age] == 40
  end

  def test_name
    old = @parser[:time]
    sleep 1
    assert old < @parser[:time]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
args_parser-0.1.4 test/test_default.rb