Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix command line parsing (RT #114720)

  • Loading branch information...
commit 86b5b436f8248794e3022c18328b9ae274472c59 1 parent 56ae4f0
@moritz moritz authored
Showing with 5 additions and 5 deletions.
  1. +0 −4 src/HLL/CommandLine.pm
  2. +5 −1 t/hll/05-commandline.t
View
4 src/HLL/CommandLine.pm
@@ -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
6 t/hll/05-commandline.t
@@ -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');
Please sign in to comment.
Something went wrong with that request. Please try again.