Follow getopt in parsing option-like values.

The getopt function (and the GNU getopt_long extension) are the de facto
standards for option parsing, so we should follow their behavior to make
Dart programs consistent with other languages.

Closes #36

R=rnystrom@google.com

Review URL: https://codereview.chromium.org//1165263003
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 74a6d1e..96df1dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 0.13.1+1
+
+* Allow option values that look like options. This more closely matches the
+  behavior of [`getopt`][getopt], the *de facto* standard for option parsing.
+
+[getopt]: http://man7.org/linux/man-pages/man3/getopt.3.html
+
 ## 0.13.1
 
 * Add `ArgParser.addSeparator()`. Separators allow users to group their options
diff --git a/lib/src/parser.dart b/lib/src/parser.dart
index 848bb9c..a10692d 100644
--- a/lib/src/parser.dart
+++ b/lib/src/parser.dart
@@ -103,10 +103,6 @@
     // Take the option argument from the next command line arg.
     validate(args.length > 0, 'Missing argument for "${option.name}".');
 
-    // Make sure it isn't an option itself.
-    validate(!_ABBR_OPT.hasMatch(current) && !_LONG_OPT.hasMatch(current),
-        'Missing argument for "${option.name}".');
-
     setOption(results, option, current);
     args.removeAt(0);
   }
diff --git a/pubspec.yaml b/pubspec.yaml
index 3b71ea3..3ea1a11 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: args
-version: 0.13.1
+version: 0.13.2
 author: "Dart Team <misc@dartlang.org>"
 homepage: https://github.com/dart-lang/args
 description: >
diff --git a/test/parse_test.dart b/test/parse_test.dart
index ba7453c..39027c2 100644
--- a/test/parse_test.dart
+++ b/test/parse_test.dart
@@ -315,14 +315,15 @@
         throwsFormat(parser, ['-f']);
       });
 
-      test('throw if the value looks like an option', () {
+      test('does not throw if the value looks like an option', () {
         var parser = new ArgParser();
         parser.addOption('file', abbr: 'f');
         parser.addOption('other');
 
-        throwsFormat(parser, ['-f', '--other']);
-        throwsFormat(parser, ['-f', '--unknown']);
-        throwsFormat(parser, ['-f', '-abbr']);
+        expect(parser.parse(['-f', '--other'])['file'], equals('--other'));
+        expect(parser.parse(['-f', '--unknown'])['file'], equals('--unknown'));
+        expect(parser.parse(['-f', '-abbr'])['file'], equals('-abbr'));
+        expect(parser.parse(['-f', '--'])['file'], equals('--'));
       });
 
       test('throw if the value is not allowed', () {
@@ -409,14 +410,16 @@
         throwsFormat(parser, ['--mode']);
       });
 
-      test('throw if the value looks like an option', () {
+      test('do not throw if the value looks like an option', () {
         var parser = new ArgParser();
         parser.addOption('mode');
         parser.addOption('other');
 
-        throwsFormat(parser, ['--mode', '--other']);
-        throwsFormat(parser, ['--mode', '--unknown']);
-        throwsFormat(parser, ['--mode', '-abbr']);
+        expect(parser.parse(['--mode', '--other'])['mode'], equals('--other'));
+        expect(parser.parse(['--mode', '--unknown'])['mode'],
+            equals('--unknown'));
+        expect(parser.parse(['--mode', '-abbr'])['mode'], equals('-abbr'));
+        expect(parser.parse(['--mode', '--'])['mode'], equals('--'));
       });
 
       test('do not throw if the value is in the allowed set', () {