From 9e840221ee2dbc8afd6af34bf9f5a5f7576ab482 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 13 Aug 2009 00:12:16 +0000 Subject: [PATCH] Delete t/maint from MW. Not tests specific to MW, so I've moved them to tools/code-utils --- t/maint/bom.t | 38 -------------------------------------- t/maint/eol-style.t | 35 ----------------------------------- t/maint/php-lint.t | 33 --------------------------------- t/maint/php-tag.t | 29 ----------------------------- t/maint/unix-newlines.t | 33 --------------------------------- 5 files changed, 168 deletions(-) delete mode 100644 t/maint/bom.t delete mode 100644 t/maint/eol-style.t delete mode 100644 t/maint/php-lint.t delete mode 100644 t/maint/php-tag.t delete mode 100644 t/maint/unix-newlines.t diff --git a/t/maint/bom.t b/t/maint/bom.t deleted file mode 100644 index b5e6ae9864..0000000000 --- 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 2e281dc457..0000000000 --- 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 $/;

. "" }; - 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 6687a08940..0000000000 --- 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 $/;

. "" }; - 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 5093ca7f6f..0000000000 --- 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 "; - } elsif ( $cont =~ m<<\? .* \?>>xs ) { - fail "$file does not use "; - } else { - pass "$file has neither nor , check it"; - } -} - - - diff --git a/t/maint/unix-newlines.t b/t/maint/unix-newlines.t deleted file mode 100644 index c47dd17cdb..0000000000 --- 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; -} - - - -- 2.20.1