r24278 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24277‎ | r24278 | r24279 >
Date:00:05, 20 July 2007
Author:avar
Status:old
Tags:
Comment:
don't slurp the whole file, we only need to test line 1, this speeds things up immensely
Modified paths:
  • / (modified) (history)
  • /trunk/phase3/t/maint/bom.t (modified) (history)

Diff [purge]

Index: trunk/phase3/t/maint/bom.t
@@ -14,14 +14,12 @@
1515 use Test::More;
1616
1717 use File::Find;
18 -use File::Slurp qw< slurp >;
1918
2019 # Files for wich we want to check the BOM char ( 0xFE 0XFF )
2120 my $ext = qr/(?:php|inc)/x ;
2221
2322 my $bomchar = qr/\xef\xbb\xbf/ ;
2423
25 -
2624 my @files;
2725
2826 find( sub{ push @files, $File::Find::name if -f && /\.$ext$/ }, '.' );
@@ -30,10 +28,11 @@
3129 plan tests => scalar @files ;
3230
3331 for my $file (@files) {
34 - my $content = slurp $file ;
35 - if( $content =~ /$bomchar/ ) {
36 - fail "$file got a Byte Order Mark";
 32+ open my $fh, "<", $file or die "Couln't open $file: $!";
 33+ my $line = <$fh>;
 34+ if( $line =~ /$bomchar/ ) {
 35+ fail "$file has a Byte Order Mark at line $.";
3736 } else {
38 - pass "$file BOM less";
 37+ pass "$file has no Byte Order Mark!";
3938 }
4039 }
Property changes on: .
___________________________________________________________________
Modified: svk:merge
4140 - 27bc04cf-33ed-4153-9a14-f265503a8842:/local/mediawiki:61330
7cf7ea9e-0fb0-4aec-bfeb-b705e7e456c6:/local/mediawiki:61660
4241 + 27bc04cf-33ed-4153-9a14-f265503a8842:/local/mediawiki:61331
7cf7ea9e-0fb0-4aec-bfeb-b705e7e456c6:/local/mediawiki:61660

Follow-up revisions

RevisionCommit summaryAuthorDate
r24302Merged revisions 24276-24301 via svnmerge from...david03:42, 21 July 2007

Status & tagging log