Skip to content

Commit 88f00e1

Browse files
committed
fix and test multiple uses of same command line option
1 parent 42329b4 commit 88f00e1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/HLL/CommandLine.pm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,10 @@ class HLL::CommandLine::Result {
109109
# how I miss p6's Hash.push
110110

111111
if pir::exists(%!options, $name) {
112-
my $t := pir::typeof(%!options);
113-
if $t eq 'ResizablePMCArray' {
112+
if pir::does(%!options{$name}, 'array') {
114113
pir::push(%!options{$name}, $value);
115114
} else {
116-
%!options{$name} := [ %!options{$name}, $name ];
115+
%!options{$name} := [ %!options{$name}, $value ];
117116
}
118117
} else {
119118
%!options{$name} := $value;

t/hll/05-commandline.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! nqp
22

3-
plan(29);
3+
plan(30);
44

55
use NQPHLL;
66

@@ -78,3 +78,6 @@ ok($r.options{'with-arg'} eq 'v2', 'short+long alias with value(right)');
7878

7979
ok($r.options<o> eq 'v4', 'long|short alias (short)');
8080
ok($r.options<other> eq 'v3', 'long|short alias (short)');
81+
82+
$r := $x.parse(['-w', 'A', '-w', 'B']);
83+
ok(nqp::join(',', $r.options<w>) eq 'A,B', 'multiple options with the same name');

0 commit comments

Comments
 (0)