1
1
# ! nqp
2
2
3
- plan (25 );
3
+ plan (27 );
4
4
5
5
my $ x := HLL::CommandLine::Parser. new ([' a' , ' b' , ' e=s' , ' target=s' , ' verbose' ]);
6
6
my $ r := $ x . parse([' -a' , ' b' ]);
@@ -53,8 +53,10 @@ ok(pir::join(',', $r.arguments) eq 'script.pl,--verbose',
53
53
54
54
# TODO: tests for long options as stoppers
55
55
56
- $ x := HLL::CommandLine::Parser. new ([' a|b' , ' l|long' , ' w|with-arg=s' ]);
56
+ $ x := HLL::CommandLine::Parser. new ([' a|b' , ' l|long' ,
57
+ ' w|with-arg=s' , ' other|o=s' ]);
57
58
$ r := $ x . parse([' -a' , ' -b' , ' -l' , ' --long' , ' -w' , ' v1' ,
59
+ ' --other=v3' , ' -o' , ' v4' ,
58
60
' --with-arg' , ' v2' , ' arg1' , ' arg2' ]);
59
61
60
62
ok (pir:: join (' ,' , $ r . arguments) eq ' arg1,arg2' ,
@@ -67,3 +69,6 @@ ok($r.options{'long'} == 1, 'short+long alias (right)');
67
69
68
70
ok ($ r . options{' w' } eq ' v1' , ' short+long alias with value (left)' );
69
71
ok ($ r . options{' with-arg' } eq ' v2' , ' short+long alias with value(right)' );
72
+
73
+ ok ($ r . options<o > eq ' v4' , ' long|short alias (short)' );
74
+ ok ($ r . options<other > eq ' v3' , ' long|short alias (short)' );
0 commit comments