<NME> slop_test.rb
<BEF> require "test_helper"

describe Slop do
  describe ".parse" do
    it "parses a list of arguments" do
      result = Slop.parse(%w[--name Lee]) do |o|
        o.string "--name"
      end

      assert_equal "Lee", result[:name]
    end
  end

  describe ".option_defined?" do
    it "handles bad constant names" do
      assert_equal false, Slop.option_defined?("Foo?Bar")
    end

    it "returns false if the option is not defined" do
      assert_equal false, Slop.option_defined?("FooBar")
    end

    it "returns true if the option is defined" do
      assert_equal true, Slop.option_defined?("String")
    end
  end
end
    assert_empty items
  end

  test '#parse! removes parsed items prefixed with --no-' do
    items = %w/--no-foo/
    Slop.new { |opt| opt.on :foo }.parse!(items)

<MSG> Merge pull request #22 from utkarshkukreti/bug-22.

Minor bugfix on parse!
<DFF> @@ -145,6 +145,12 @@ class SlopTest < TestCase
     assert_empty items
   end
 
+  test '#parse! does not remove unparsed items with same value as a parsed item' do
+    items = %w/bar --foo bar/
+    Slop.new { |opt| opt.on :foo, 'foo', true }.parse!(items)
+    assert_equal %w/bar/, items
+  end
+
   test '#parse! removes parsed items prefixed with --no-' do
     items = %w/--no-foo/
     Slop.new { |opt| opt.on :foo }.parse!(items)

{'addition_count': 6, 'commit_subject': 'Merge pull request #22 from utkarshkukreti/bug-22.', 'deletion_count': 0, 'file_extension': '.rb', 'lang': 'rb', 'license': 'mit', 'repo_name': 'leejarvis/slop'}