summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/test
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-11-26 11:59:49 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-11-26 11:59:49 +0000
commitc25787f5286ecd4c765fbf41e203036891c5f3ad (patch)
treece8b4d5533be34544b9f0059ce90a670b6a6d39a /perl_checker.src/test
parent422d55f021d4fdd1dfa5eb460e816ce316f73687 (diff)
downloadperl_checker-c25787f5286ecd4c765fbf41e203036891c5f3ad.tar
perl_checker-c25787f5286ecd4c765fbf41e203036891c5f3ad.tar.gz
perl_checker-c25787f5286ecd4c765fbf41e203036891c5f3ad.tar.bz2
perl_checker-c25787f5286ecd4c765fbf41e203036891c5f3ad.tar.xz
perl_checker-c25787f5286ecd4c765fbf41e203036891c5f3ad.zip
warn about blocks ending with a ";"
Diffstat (limited to 'perl_checker.src/test')
-rwxr-xr-xperl_checker.src/test/test_it6
1 files changed, 5 insertions, 1 deletions
diff --git a/perl_checker.src/test/test_it b/perl_checker.src/test/test_it
index fc2e70f..2f7c599 100755
--- a/perl_checker.src/test/test_it
+++ b/perl_checker.src/test/test_it
@@ -65,7 +65,11 @@ foreach my $test (@tests) {
if ($l[-1] !~ /(;|[\s{]\})\s+$/) {
$l[-1] =~ s/^(.*?)(\s+$)/xxx($1);$2/;
} else {
- my $no_comma = $l[-1] =~ /(^\s*(for|foreach|if|unless|while|sub)\s)|(;\s+$)/;
+ # no comma for:
+ # - prefix for/foreach/...
+ # - already a comma
+ # - a block { ... }
+ my $no_comma = $l[-1] =~ /(^\s*(for|foreach|if|unless|while|sub)\s)|(;\s+$)|(^{.*}\s*$)/;
my $opt_comma = $no_comma ? '' : ';';
$l[-1] =~ s/(\s+$)/$opt_comma nop();$1/;
}