r69971 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69970‎ | r69971 | r69972 >
Date:21:01, 26 July 2010
Author:platonides
Status:ok
Tags:
Comment:
From global to parameter.
Modified paths:
  • /trunk/phase3/includes/normal/UtfNormalTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/normal/UtfNormalTest.php
@@ -87,7 +87,7 @@
8888
8989 $testedChars[$columns[1]] = true;
9090 $total++;
91 - if( testNormals( $normalizer, $columns, $comment ) ) {
 91+ if( testNormals( $normalizer, $columns, $comment, $verbose ) ) {
9292 $success++;
9393 } else {
9494 $failure++;
@@ -119,7 +119,7 @@
120120 }
121121 if( empty( $testedChars[$char] ) ) {
122122 $total++;
123 - if( testInvariant( $normalizer, $char, $desc ) ) {
 123+ if( testInvariant( $normalizer, $char, $desc, $verbose ) ) {
124124 $success++;
125125 } else {
126126 $failure++;
@@ -154,17 +154,16 @@
155155 return $ok;
156156 }
157157
158 -function testNormals( &$u, $c, $comment, $reportFailure = false ) {
 158+function testNormals( &$u, $c, $comment, $verbose, $reportFailure = false ) {
159159 $result = testNFC( $u, $c, $comment, $reportFailure );
160160 $result = testNFD( $u, $c, $comment, $reportFailure ) && $result;
161161 $result = testNFKC( $u, $c, $comment, $reportFailure ) && $result;
162162 $result = testNFKD( $u, $c, $comment, $reportFailure ) && $result;
163163 $result = testCleanUp( $u, $c, $comment, $reportFailure ) && $result;
164164
165 - global $verbose;
166165 if( $verbose && !$result && !$reportFailure ) {
167166 print $comment;
168 - testNormals( $u, $c, $comment, true );
 167+ testNormals( $u, $c, $comment, $verbose, true );
169168 }
170169 return $result;
171170 }
@@ -232,16 +231,16 @@
233232 return $result;
234233 }
235234
236 -function testInvariant( &$u, $char, $desc, $reportFailure = false ) {
 235+function testInvariant( &$u, $char, $desc, $verbose, $reportFailure = false ) {
237236 $result = verbosify( $char, $u->toNFC( $char ), 1, 'NFC', $reportFailure );
238237 $result = verbosify( $char, $u->toNFD( $char ), 1, 'NFD', $reportFailure ) && $result;
239238 $result = verbosify( $char, $u->toNFKC( $char ), 1, 'NFKC', $reportFailure ) && $result;
240239 $result = verbosify( $char, $u->toNFKD( $char ), 1, 'NFKD', $reportFailure ) && $result;
241240 $result = verbosify( $char, $u->cleanUp( $char ), 1, 'cleanUp', $reportFailure ) && $result;
242 - global $verbose;
 241+
243242 if( $verbose && !$result && !$reportFailure ) {
244243 print $desc;
245 - testInvariant( $u, $char, $desc, true );
 244+ testInvariant( $u, $char, $desc, $verbose, true );
246245 }
247246 return $result;
248247 }

Status & tagging log