http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70080
Revision: 70080
Author: platonides
Date: 2010-07-28 12:07:53 +0000 (Wed, 28 Jul 2010)
Log Message:
-----------
>From globals to parameters: $columns, $exceptions, $verbose
New line after the error messages.
Modified Paths:
--------------
trunk/phase3/includes/normal/Utf8Test.php
Modified: trunk/phase3/includes/normal/Utf8Test.php
===================================================================
--- trunk/phase3/includes/normal/Utf8Test.php 2010-07-28 11:46:33 UTC (rev
70079)
+++ trunk/phase3/includes/normal/Utf8Test.php 2010-07-28 12:07:53 UTC (rev
70080)
@@ -30,6 +30,7 @@
require_once 'UtfNormal.php';
mb_internal_encoding( "utf-8" );
+$verbose = false;
#$verbose = true;
if( php_sapi_name() != 'cli' ) {
die( "Run me from the command line please.\n" );
@@ -39,7 +40,7 @@
if( !$in ) {
print "Couldn't open UTF-8-test.txt -- can't run tests.\n";
print "If necessary, manually download this file. It can be obtained
at\n";
- print "http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt";
+ print "http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt\n";
exit(-1);
}
@@ -55,7 +56,7 @@
if( !$columns ) {
print "Something seems to be wrong; couldn't extract line length.\n";
print "Check that UTF-8-test.txt was downloaded correctly from\n";
- print "http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt";
+ print "http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt\n";
exit(-1);
}
@@ -102,10 +103,10 @@
if( in_array( $test, $longTests ) ) {
$line = fgets( $in );
for( $line = fgets( $in ); !preg_match( '/^\s+\|/',
$line ); $line = fgets( $in ) ) {
- testLine( $test, $line, $total, $success,
$failed );
+ testLine( $test, $line, $total, $success,
$failed, $columns, $exceptions, $verbose );
}
} else {
- testLine( $test, $line, $total, $success, $failed );
+ testLine( $test, $line, $total, $success, $failed,
$columns, $exceptions, $verbose );
}
}
}
@@ -120,7 +121,7 @@
exit (0);
-function testLine( $test, $line, &$total, &$success, &$failed ) {
+function testLine( $test, $line, &$total, &$success, &$failed, $columns,
$exceptions, $verbose ) {
$stripped = $line;
UtfNormal::quickisNFCVerify( $stripped );
@@ -130,10 +131,8 @@
$len = strlen( substr( $stripped, 0, strpos( $stripped, '|' ) )
);
}
- global $columns;
$ok = $same ^ ($test >= 3 );
- global $exceptions;
$ok ^= in_array( $test, $exceptions );
$ok &= ($columns == $len);
@@ -144,7 +143,7 @@
} else {
$failed++;
}
- global $verbose;
+
if( $verbose || !$ok ) {
print str_replace( "\n", "$len\n", $stripped );
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs