From 0fffa1926708345671f27d70848d2fb8733e0c88 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 11 Nov 2010 21:33:48 +1300 Subject: [PATCH] Merge remote branch 'kc/new/bug_5105' into kcmaster (cherry picked from commit 235cf872a5c40a0baae554bdb28ec98c4520c528) Signed-off-by: Chris Nighswonger --- t/00-deprecated.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 t/00-deprecated.t diff --git a/t/00-deprecated.t b/t/00-deprecated.t new file mode 100755 index 0000000000..6eba09deba --- /dev/null +++ b/t/00-deprecated.t @@ -0,0 +1,27 @@ +#!/usr/bin/perl +# +# Tests usage of deprecated Perl syntax. Deprecated could be extended to the +# sense of 'not allowed'. +# +use warnings; +use strict; +use Test::More tests => 1; +use File::Find; +use Cwd; + +my @files_with_switch = do { + my @files; + local $/ = undef; + find( sub { + my $dir = getcwd(); + return if $dir =~ /blib/; + return unless /\.(pl|pm)$/; # Don't inspect non-Perl files + open my $fh, "<", $_; + my $content = <$fh>; + push @files, "$dir/$_" if $content =~ /switch\s*\(.*{/; + }, ( '.' ) ); + @files; +}; +ok( !@files_with_switch, "Perl syntax: no use of switch statement" ) + or diag( "Files list: " . join(', ', @files_with_switch) ); + -- 2.39.5