summaryrefslogtreecommitdiff
path: root/includes/normal/UtfNormalTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /includes/normal/UtfNormalTest.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'includes/normal/UtfNormalTest.php')
-rw-r--r--includes/normal/UtfNormalTest.php54
1 files changed, 27 insertions, 27 deletions
diff --git a/includes/normal/UtfNormalTest.php b/includes/normal/UtfNormalTest.php
index ee1da4d0..f78775ce 100644
--- a/includes/normal/UtfNormalTest.php
+++ b/includes/normal/UtfNormalTest.php
@@ -1,29 +1,30 @@
<?php
-# Copyright (C) 2004 Brion Vibber <brion@pobox.com>
-# http://www.mediawiki.org/
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# http://www.gnu.org/copyleft/gpl.html
-
/**
* Implements the conformance test at:
* http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt
+ *
+ * Copyright © 2004 Brion Vibber <brion@pobox.com>
+ * http://www.mediawiki.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
* @ingroup UtfNormal
*/
-/** */
$verbose = true;
#define( 'PRETTY_UTF8', true );
@@ -87,7 +88,7 @@ while( false !== ( $line = fgets( $in ) ) ) {
$testedChars[$columns[1]] = true;
$total++;
- if( testNormals( $normalizer, $columns, $comment ) ) {
+ if( testNormals( $normalizer, $columns, $comment, $verbose ) ) {
$success++;
} else {
$failure++;
@@ -119,7 +120,7 @@ while( false !== ($line = fgets( $in ) ) ) {
}
if( empty( $testedChars[$char] ) ) {
$total++;
- if( testInvariant( $normalizer, $char, $desc ) ) {
+ if( testInvariant( $normalizer, $char, $desc, $verbose ) ) {
$success++;
} else {
$failure++;
@@ -154,17 +155,16 @@ function reportResults( &$total, &$success, &$failure ) {
return $ok;
}
-function testNormals( &$u, $c, $comment, $reportFailure = false ) {
+function testNormals( &$u, $c, $comment, $verbose, $reportFailure = false ) {
$result = testNFC( $u, $c, $comment, $reportFailure );
$result = testNFD( $u, $c, $comment, $reportFailure ) && $result;
$result = testNFKC( $u, $c, $comment, $reportFailure ) && $result;
$result = testNFKD( $u, $c, $comment, $reportFailure ) && $result;
$result = testCleanUp( $u, $c, $comment, $reportFailure ) && $result;
- global $verbose;
if( $verbose && !$result && !$reportFailure ) {
print $comment;
- testNormals( $u, $c, $comment, true );
+ testNormals( $u, $c, $comment, $verbose, true );
}
return $result;
}
@@ -232,16 +232,16 @@ function testNFKD( &$u, $c, $comment, $verbose ) {
return $result;
}
-function testInvariant( &$u, $char, $desc, $reportFailure = false ) {
+function testInvariant( &$u, $char, $desc, $verbose, $reportFailure = false ) {
$result = verbosify( $char, $u->toNFC( $char ), 1, 'NFC', $reportFailure );
$result = verbosify( $char, $u->toNFD( $char ), 1, 'NFD', $reportFailure ) && $result;
$result = verbosify( $char, $u->toNFKC( $char ), 1, 'NFKC', $reportFailure ) && $result;
$result = verbosify( $char, $u->toNFKD( $char ), 1, 'NFKD', $reportFailure ) && $result;
$result = verbosify( $char, $u->cleanUp( $char ), 1, 'cleanUp', $reportFailure ) && $result;
- global $verbose;
+
if( $verbose && !$result && !$reportFailure ) {
print $desc;
- testInvariant( $u, $char, $desc, true );
+ testInvariant( $u, $char, $desc, $verbose, true );
}
return $result;
}