Sha256: 9ce5de1ae68e9f754428e7cee666030061a72473a76f275fd3a66a1252852f36

Contents?: true

Size: 566 Bytes

Versions: 2

Compression:

Stored size: 566 Bytes

Contents

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

class TestArgsParserDefault < MiniTest::Test
  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

2 entries across 2 versions & 1 rubygems

Version Path
args_parser-0.1.6 test/test_default.rb
args_parser-0.1.5 test/test_default.rb