Skip to content

Commit

Permalink
make [string compare]'s current special case explicit.
Browse files Browse the repository at this point in the history
t/cmd_string.t now runs to completion.
  • Loading branch information
coke committed Dec 1, 2009
1 parent d9e1e35 commit 1dbaf7a
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/PmTcl/commands/string.pm
Expand Up @@ -11,16 +11,20 @@ our sub string(*@args) {

return pir::bytelength__is(~@args[0]);
} elsif $cmd eq 'compare' {
@args.shift; # assuming -nocase here.
my $s1 := pir::upcase(@args[0]);
my $s2 := pir::upcase(@args[1]);
if ($s1 eq $s2) {
return 0;
} elsif ($s1 lt $s2) {
return -1;
} else {
return 1;
}
if +@args == 3 {
@args.shift; # assuming -nocase here.
my $s1 := pir::upcase(@args[0]);
my $s2 := pir::upcase(@args[1]);
if ($s1 eq $s2) {
return 0;
} elsif ($s1 lt $s2) {
return -1;
} else {
return 1;
}
} else {
return '';
}
} elsif $cmd eq 'equal' {
return '';
} elsif $cmd eq 'first' {
Expand Down

0 comments on commit 1dbaf7a

Please sign in to comment.