|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
| 3 |
use Modern::Perl; |
| 4 |
use sigtrap qw/die normal-signals/; |
| 5 |
|
| 6 |
use Cwd qw(realpath); |
| 7 |
use File::Basename; |
| 8 |
use File::Find; |
| 9 |
use File::Spec; |
| 10 |
use FindBin; |
| 11 |
use Test::More; |
| 12 |
|
| 13 |
my $root = realpath("$FindBin::RealBin/.."); |
| 14 |
|
| 15 |
my @filepaths; |
| 16 |
sub wanted { |
| 17 |
my $filepath = $File::Find::name; |
| 18 |
if ($filepath =~ /\.(pm|pl)$/) { |
| 19 |
push @filepaths, $filepath; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
find( { wanted => \&wanted, no_chdir => 1 }, $root ); |
| 24 |
|
| 25 |
plan tests => scalar @filepaths; |
| 26 |
|
| 27 |
foreach my $filepath (@filepaths) { |
| 28 |
my $rel_path = File::Spec->abs2rel($filepath, $root); |
| 29 |
my $cmd = sprintf('perl -c "%s" 2>&1', $filepath); |
| 30 |
|
| 31 |
# FIXME It's the only file that requires a specific @INC |
| 32 |
# We should move misc/translator/*.pm to Koha namespace |
| 33 |
if ($rel_path eq 'misc/translator/TmplTokenizer.pm') { |
| 34 |
my $inc = dirname($filepath); |
| 35 |
$cmd = sprintf('perl -I "%s" -c "%s" 2>&1', $inc, $filepath); |
| 36 |
} |
| 37 |
|
| 38 |
my $output = `$cmd`; |
| 39 |
like($output, qr/syntax OK/, $rel_path); |
| 40 |
} |