Sha256: 9131bd16a2869b7385158cb05ad32b9adab21ee0fae6c21a398cae78901bf50b

Contents?: true

Size: 604 Bytes

Versions: 6

Compression:

Stored size: 604 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

class TestArgsParserFilter < Test::Unit::TestCase
  def setup
    @argv = ['--count', '35']
    @@err = nil
    @@name = nil
    @@value = nil
    @parser = ArgsParser.parse @argv do
      arg :count, 'number'

      filter :count do |v|
        raise NoMethodError, 'error!!'
      end

      on_filter_error do |err, name, value|
        @@err = err
        @@name = name
        @@value = value
      end
    end
  end

  def test_filter_error
    assert @@name == :count
    assert @@value == '35'
    assert @@err.class == NoMethodError
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
args_parser-0.1.2 test/test_filter.rb
args_parser-0.1.1 test/test_filter.rb
args_parser-0.1.0 test/test_filter.rb
args_parser-0.0.10 test/test_filter.rb
args_parser-0.0.9 test/test_filter.rb
args_parser-0.0.8 test/test_filter.rb