Permalink
Browse files

fix command line parsing (RT #114720)

  • Loading branch information...
1 parent 56ae4f0 commit 86b5b436f8248794e3022c18328b9ae274472c59 @moritz moritz committed Oct 14, 2012
Showing with 5 additions and 5 deletions.
  1. +0 −4 src/HLL/CommandLine.pm
  2. +5 −1 t/hll/05-commandline.t
View
@@ -199,10 +199,6 @@ class HLL::CommandLine::Parser {
sub get-value($opt) {
if $i == $arg-count - 1 {
nqp::die("Option $opt needs a value");
- } elsif self.is-option(@args[$i + 1]) {
- nqp::die("Option $opt needs a value, but is followed by an option");
- } elsif %!stopper{@args[$i + 1]} {
- nqp::die("Option $opt needs a value, but is followed by a stopper");
} else {
$i++;
@args[$i];
View
@@ -1,6 +1,6 @@
#! nqp
-plan(30);
+plan(31);
use NQPHLL;
@@ -81,3 +81,7 @@ ok($r.options<other> eq 'v3', 'long|short alias (short)');
$r := $x.parse(['-w', 'A', '-w', 'B']);
ok(nqp::join(',', $r.options<w>) eq 'A,B', 'multiple options with the same name');
+
+$x := HLL::CommandLine::Parser.new(['e=s']);
+$r := $x.parse(['-e', '-1 < 0']);
+ok($r.options<e> eq '-1 < 0', 'can have option values that start with a dash');

0 comments on commit 86b5b43

Please sign in to comment.