Skip to content

Commit

Permalink
Fixed tests to account for new behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
akhoury6 committed Apr 18, 2024
1 parent 07e97f0 commit 99c5ce0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Empty file added -x,
Empty file.
Empty file added :flag,
Empty file.
12 changes: 6 additions & 6 deletions test/optimist/parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -565,19 +565,19 @@ def test_short_options_with_multiple_options
assert_equal [], @p.leftovers
end

def test_short_options_with_multiple_options_does_not_affect_flags_type
def test_short_options_with_multiple_options_flag_types_get_counted
@p.opt :xarg, "desc", :short => "-x", :type => :flag, :multi => true

opts = @p.parse %w(-x a)
assert_equal true, opts[:xarg]
assert_equal 1, opts[:xarg]
assert_equal %w(a), @p.leftovers

opts = @p.parse %w(-x a -x b)
assert_equal true, opts[:xarg]
assert_equal 2, opts[:xarg]
assert_equal %w(a b), @p.leftovers

opts = @p.parse %w(-xx a -x b)
assert_equal true, opts[:xarg]
assert_equal 3, opts[:xarg]
assert_equal %w(a b), @p.leftovers
end

Expand Down Expand Up @@ -1116,10 +1116,10 @@ def test_accepts_arguments_with_spaces
assert_equal 0, @p.leftovers.size
end

def test_multi_args_default_to_empty_array
def test_multi_args_default_to_zero
@p.opt :arg1, "arg", :multi => true
opts = @p.parse []
assert_equal [], opts[:arg1]
assert_equal 0, opts[:arg1]
end

def test_simple_interface_handles_help
Expand Down
Empty file added true
Empty file.

0 comments on commit 99c5ce0

Please sign in to comment.