Skip to content

Commit

Permalink
[switch] fix -- processing;
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Jul 3, 2010
1 parent 65f1889 commit d6a32b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Partcl/commands/main.pm
Expand Up @@ -623,6 +623,7 @@ our sub switch(*@args) {
if +@args < 3 {
error('wrong # args: should be "switch ?switches? string pattern body ... ?default body?"');
}

my $regex := 0;
my $glob := 0;
my $nocase := 0;
Expand All @@ -632,6 +633,8 @@ our sub switch(*@args) {
$glob := 1 if $opt eq '-glob';
$nocase := 1 if $opt eq '-nocase';
}
@args.shift if @args[0] eq '--';

my $string := @args.shift();
if +@args % 2 == 1 {
error('extra switch pattern with no body');
Expand Down
4 changes: 2 additions & 2 deletions t/cmd_switch.t
Expand Up @@ -39,7 +39,7 @@ eval_is {
set q 1
switch -- -a -a {set q 2}
set q
} 2 {implied exact, --} {TODO NQPRX}
} 2 {implied exact, --}

eval_is {
set q 1
Expand All @@ -49,7 +49,7 @@ eval_is {
set q 3
}
set q
} 3 {implied exact, --, two choices} {TODO NQPRX}
} 3 {implied exact, --, two choices}

eval_is {
set q 1
Expand Down

0 comments on commit d6a32b8

Please sign in to comment.