Sha256: db991f3459eee4a684c437fd249c03b9818472dee55fff672921cf32518de0ec

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

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

class TestArgsParserFilter < MiniTest::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

2 entries across 2 versions & 1 rubygems

Version Path
args_parser-0.1.4 test/test_filter.rb
args_parser-0.1.3 test/test_filter.rb