@@ -565,19 +565,19 @@ def test_short_options_with_multiple_options
565565 assert_equal [ ] , @p . leftovers
566566 end
567567
568- def test_short_options_with_multiple_options_does_not_affect_flags_type
568+ def test_short_options_with_multiple_options_flag_types_get_counted
569569 @p . opt :xarg , "desc" , :short => "-x" , :type => :flag , :multi => true
570570
571571 opts = @p . parse %w( -x a )
572- assert_equal true , opts [ :xarg ]
572+ assert_equal 1 , opts [ :xarg ]
573573 assert_equal %w( a ) , @p . leftovers
574574
575575 opts = @p . parse %w( -x a -x b )
576- assert_equal true , opts [ :xarg ]
576+ assert_equal 2 , opts [ :xarg ]
577577 assert_equal %w( a b ) , @p . leftovers
578578
579579 opts = @p . parse %w( -xx a -x b )
580- assert_equal true , opts [ :xarg ]
580+ assert_equal 3 , opts [ :xarg ]
581581 assert_equal %w( a b ) , @p . leftovers
582582 end
583583
@@ -1116,12 +1116,18 @@ def test_accepts_arguments_with_spaces
11161116 assert_equal 0 , @p . leftovers . size
11171117 end
11181118
1119- def test_multi_args_default_to_empty_array
1120- @p . opt :arg1 , "arg" , :multi => true
1119+ def test_multi_args_with_specified_type_defaults_to_empty_array
1120+ @p . opt :arg1 , "arg" , :type => :string , : multi => true
11211121 opts = @p . parse [ ]
11221122 assert_equal [ ] , opts [ :arg1 ]
11231123 end
11241124
1125+ def test_multi_args_with_type_flag_defaults_to_zero
1126+ @p . opt :arg1 , "arg" , :multi => true
1127+ opts = @p . parse [ ]
1128+ assert_equal 0 , opts [ :arg1 ]
1129+ end
1130+
11251131 def test_simple_interface_handles_help
11261132 assert_stdout ( /Options:/ ) do
11271133 assert_raises ( SystemExit ) do
0 commit comments