diff options
Diffstat (limited to 't/maint')
-rw-r--r-- | t/maint/bom.t | 38 | ||||
-rw-r--r-- | t/maint/eol-style.t | 35 | ||||
-rw-r--r-- | t/maint/php-lint.t | 33 | ||||
-rw-r--r-- | t/maint/php-tag.t | 29 | ||||
-rw-r--r-- | t/maint/unix-newlines.t | 33 |
5 files changed, 0 insertions, 168 deletions
diff --git a/t/maint/bom.t b/t/maint/bom.t deleted file mode 100644 index b5e6ae98..00000000 --- a/t/maint/bom.t +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env perl -# -# This test detect Byte Order Mark (BOM). The char is sometime included at the -# top of files by some text editors to mark them as being UTF-8 encoded. -# They are not stripped by php 5.x and appear at the beginning of our content, -# You want them removed! -# See: -# http://www.fileformat.info/info/unicode/char/feff/index.htm -# http://bugzilla.wikimedia.org/show_bug.cgi?id=9954 - -use strict; -use warnings; - -use Test::More; - -use File::Find; - -# Files for wich we want to check the BOM char ( 0xFE 0XFF ) -my $ext = qr/(?:php|inc)/x ; - -my $bomchar = qr/\xef\xbb\xbf/ ; - -my @files; - -find( sub{ push @files, $File::Find::name if -f && /\.$ext$/ }, '.' ); - -# Register our files with the test system -plan tests => scalar @files ; - -for my $file (@files) { - open my $fh, "<", $file or die "Couln't open $file: $!"; - my $line = <$fh>; - if( $line =~ /$bomchar/ ) { - fail "$file has a Byte Order Mark at line $."; - } else { - pass "$file has no Byte Order Mark!"; - } -} diff --git a/t/maint/eol-style.t b/t/maint/eol-style.t deleted file mode 100644 index 2e281dc4..00000000 --- a/t/maint/eol-style.t +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env perl -# -# Based on php-tag.t -# -use strict; -use warnings; - -use Test::More; -use File::Find; -use IPC::Open3; -use File::Spec; -use Symbol qw(gensym); - -my $ext = qr/(?: php | inc | txt | sql | t)/x; -my @files; - -find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' ); - -plan tests => scalar @files ; - -for my $file (@files) { - open NULL, '+>', File::Spec->devnull and \*NULL or die; - my $pid = open3('<&NULL', \*P, '>&NULL', qw'svn propget svn:eol-style', $file); - my $res = do { local $/; <P> . "" }; - chomp $res; - waitpid $pid, 0; - - if ( $? != 0 ) { - pass "svn propget failed, $file probably not under version control"; - } elsif ( $res eq 'native' ) { - pass "$file svn:eol-style is 'native'"; - } else { - fail "$file svn:eol-style is '$res', should be 'native'"; - } -} diff --git a/t/maint/php-lint.t b/t/maint/php-lint.t deleted file mode 100644 index 6687a089..00000000 --- a/t/maint/php-lint.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -# -# Based on php-tag.t and eol-style -# -use strict; -use warnings; - -use Test::More; -use File::Find; -use IPC::Open3; -use File::Spec; -use Symbol qw(gensym); - -my $ext = qr/(?: php | inc )/x; -my @files; - -find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' ); - -plan tests => scalar @files ; - -for my $file (@files) { - open NULL, '+>', File::Spec->devnull and \*NULL or die; - my $pid = open3('<&NULL', \*P, '>&NULL', qw'php -l', $file); - my $res = do { local $/; <P> . "" }; - chomp $res; - waitpid $pid, 0; - - if ( $? == 0 ) { - pass($file); - } else { - fail("$file does not pass php -l. Error was: $res"); - } -} diff --git a/t/maint/php-tag.t b/t/maint/php-tag.t deleted file mode 100644 index 5093ca7f..00000000 --- a/t/maint/php-tag.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -use Test::More;; - -use File::Find; -use File::Slurp qw< slurp >; - -my $ext = qr/(?: php | inc )/x; - -my @files; -find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' ); - -plan tests => scalar @files; - -for my $file (@files) { - my $cont = slurp $file; - if ( $cont =~ m<<\?php .* \?>>xs ) { - pass "$file has <?php ?>"; - } elsif ( $cont =~ m<<\? .* \?>>xs ) { - fail "$file does not use <? ?>"; - } else { - pass "$file has neither <?php ?> nor <? ?>, check it"; - } -} - - - diff --git a/t/maint/unix-newlines.t b/t/maint/unix-newlines.t deleted file mode 100644 index c47dd17c..00000000 --- a/t/maint/unix-newlines.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -use Test::More;; - -use File::Find; -use Socket '$CRLF'; - -my $ext = qr/(?: t | pm | sql | js | php | inc | xml )/x; - -my @files; -find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' ); - -plan 'no_plan'; - -for my $file (@files) { - open my $fh, "<", $file or die "Can't open $file: $!"; - binmode $fh; - - my $ok = 1; - while (<$fh>) { - if (/$CRLF/) { - fail "$file has \\r\\n on line $."; - $ok = 0; - } - } - - pass "$file has only unix newlines" if $ok; -} - - - |