File: | t/00-deprecated.t |
Coverage: | 92.7% |
line | stmt | bran | cond | sub | time | code |
---|---|---|---|---|---|---|
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 | 1 1 1 | 1.33283492600295e+15 28 87 | use warnings; | |||
7 | 1 1 1 | 25 19 43 | use strict; | |||
8 | 1 1 1 | 247 19684 34 | use Test::More tests => 1; | |||
9 | 1 1 1 | 1733 11305 64 | use File::Find; | |||
10 | 1 1 1 | 5 1 46863 | use Cwd; | |||
11 | ||||||
12 | 1 | 139155 | my @files_with_switch = do { | |||
13 | 1 | 42 | my @files; | |||
14 | 1 | 37 | local $/ = undef; | |||
15 | find( sub { | |||||
16 | 9554 | 306595 | my $dir = getcwd(); | |||
17 | 9554 | 25744 | return if $dir =~ /blib/; | |||
18 | 9554 | 76077 | return unless /\.(pl|pm)$/; # Don't inspect non-Perl files | |||
19 | 765 | 11873 | open my $fh, "<", $_; | |||
20 | 765 | 224221 | my $content = <$fh>; | |||
21 | 765 | 18038 | push @files, "$dir/$_" if $content =~ /switch\s*\(.*{/; | |||
22 | 1 | 47 | }, ( '.' ) ); | |||
23 | 1 | 279 | @files; | |||
24 | }; | |||||
25 | 1 | 42 | ok( !@files_with_switch, "Perl syntax: no use of switch statement" ) | |||
26 | or diag( "Files list: " . join(', ', @files_with_switch) ); | |||||
27 |