test/test_option_parser.rb in cri-2.5.0 vs test/test_option_parser.rb in cri-2.6.0
- old
+ new
@@ -21,11 +21,11 @@
assert_raises(Cri::OptionParser::IllegalOptionError) do
parser = Cri::OptionParser.parse(input, definitions)
end
end
- def test_parse_without_options
+ def test_parse_with_unused_options
input = %w( foo )
definitions = [
{ :long => 'aaa', :short => 'a', :argument => :forbidden }
]
@@ -275,8 +275,20 @@
]
assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
parser = Cri::OptionParser.parse(input, definitions)
end
+ end
+
+ def test_parse_with_multiple_options
+ input = %w( foo -o test -o test2 -v -v -v)
+ definitions = [
+ { :long => 'long', :short => 'o', :argument => :required, :multiple => true },
+ { :long => 'verbose', :short => 'v', :multiple => true }
+ ]
+ parser = Cri::OptionParser.parse(input, definitions)
+
+ assert_equal(['test', 'test2'], parser.options[:long])
+ assert_equal(3, parser.options[:verbose].size)
end
end