Class: ArgumentProcessorTest

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/argument_processor.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



87
88
89
90
91
92
# File 'lib/argument_processor.rb', line 87

def setup
  @arguments = ['fixtures/sample1.md', 'block', '--option', 'value',
                'ignored']
  @rest = ['fixtures/sample1.md', 'block', 'ignored']
  @options_parsed = [{ name: '--option', procname: 'VAL', value: 'value' }]
end

#test_process_arguments_with_positionObject



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/argument_processor.rb', line 94

def test_process_arguments_with_position
  result = []
  process_arguments(@arguments,
                    @rest, @options_parsed) do |type, item|
    result << [type, item]
  end

  expected = [
    [ArgPro::ArgIsPosition, 'fixtures/sample1.md'],
    [ArgPro::ArgIsPosition, 'block'],
    [ArgPro::ArgIsOption, { name: '--option', procname: 'VAL', value: 'value' }],
    [ArgPro::ArgIsPosition, 'ignored']
  ]
  assert_equal expected, result
end