Bug 15128 - DBRev 15128
[koha.git] / t / 00-deprecated.t
1 #!/usr/bin/perl
2 #
3 # Tests usage of deprecated Perl syntax. Deprecated could be extended to the
4 # sense of 'not allowed'.
5 #
6 use warnings;
7 use strict;
8 use Test::More tests => 1;
9 use File::Find;
10 use Cwd;
11
12 my @files_with_switch = do {
13     my @files;
14     local $/ = undef;
15     find( sub {
16         my $dir = getcwd();
17         return if $dir =~ /blib/;
18         return unless /\.(pl|pm)$/; # Don't inspect non-Perl files
19         open my $fh, "<", $_;
20         my $content = <$fh>;
21         push @files, "$dir/$_"  if $content =~ /switch\s*\(.*{/;
22       }, ( '.' ) );
23     @files;
24 };
25 ok( !@files_with_switch, "Perl syntax: no use of switch statement" )
26     or diag( "Files list: " . join(', ', @files_with_switch) );
27