1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-03 20:58:11 +02:00

Remove trailing whitespace.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2008-12-06 02:28:20 -05:00
parent 3a6b63dff1
commit 2c955af135
476 changed files with 5595 additions and 5547 deletions

View File

@@ -2,20 +2,20 @@
class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
{
protected $_entity_lookup;
function setUp() {
$this->_entity_lookup = HTMLPurifier_EntityLookup::instance();
parent::setUp();
}
function assertCleanUTF8($string, $expect = null) {
if ($expect === null) $expect = $string;
$this->assertIdentical(HTMLPurifier_Encoder::cleanUTF8($string), $expect, 'iconv: %s');
$this->assertIdentical(HTMLPurifier_Encoder::cleanUTF8($string, true), $expect, 'PHP: %s');
}
function test_cleanUTF8() {
$this->assertCleanUTF8('Normal string.');
$this->assertCleanUTF8("Test\tAllowed\nControl\rCharacters");
@@ -28,7 +28,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
// invalid codepoints
$this->assertCleanUTF8("\xED\xB0\x80", '');
}
function test_convertToUTF8_noConvert() {
// UTF-8 means that we don't touch it
$this->assertIdentical(
@@ -37,7 +37,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
'Expected identical [Binary: F6]'
);
}
function test_convertToUTF8_spuriousEncoding() {
$this->config->set('Core', 'Encoding', 'utf99');
$this->expectError('Invalid encoding utf99');
@@ -46,7 +46,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
''
);
}
function test_convertToUTF8_iso8859_1() {
$this->config->set('Core', 'Encoding', 'ISO-8859-1');
$this->assertIdentical(
@@ -54,7 +54,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
"\xC3\xB6"
);
}
function test_convertToUTF8_withoutIconv() {
$this->config->set('Core', 'Encoding', 'ISO-8859-1');
$this->config->set('Test', 'ForceNoIconv', true);
@@ -62,13 +62,13 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
HTMLPurifier_Encoder::convertToUTF8("\xF6", $this->config, $this->context),
"\xC3\xB6"
);
}
function getZhongWen() {
return "\xE4\xB8\xAD\xE6\x96\x87 (Chinese)";
}
function test_convertFromUTF8_utf8() {
// UTF-8 means that we don't touch it
$this->assertIdentical(
@@ -76,7 +76,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
"\xC3\xB6"
);
}
function test_convertFromUTF8_iso8859_1() {
$this->config->set('Core', 'Encoding', 'ISO-8859-1');
$this->assertIdentical(
@@ -85,7 +85,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
'Expected identical [Binary: F6]'
);
}
function test_convertFromUTF8_iconvNoChars() {
if (!function_exists('iconv')) return;
$this->config->set('Core', 'Encoding', 'ISO-8859-1');
@@ -94,7 +94,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
" (Chinese)"
);
}
function test_convertFromUTF8_phpNormal() {
// Plain PHP implementation has slightly different behavior
$this->config->set('Core', 'Encoding', 'ISO-8859-1');
@@ -105,7 +105,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
'Expected identical [Binary: F6]'
);
}
function test_convertFromUTF8_phpNoChars() {
$this->config->set('Core', 'Encoding', 'ISO-8859-1');
$this->config->set('Test', 'ForceNoIconv', true);
@@ -114,7 +114,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
"?? (Chinese)"
);
}
function test_convertFromUTF8_withProtection() {
// Preserve the characters!
$this->config->set('Core', 'Encoding', 'ISO-8859-1');
@@ -123,30 +123,30 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
HTMLPurifier_Encoder::convertFromUTF8($this->getZhongWen(), $this->config, $this->context),
"&#20013;&#25991; (Chinese)"
);
}
function test_convertToASCIIDumbLossless() {
// Uppercase thorn letter
$this->assertIdentical(
HTMLPurifier_Encoder::convertToASCIIDumbLossless("\xC3\x9Eorn"),
"&#222;orn"
);
$this->assertIdentical(
HTMLPurifier_Encoder::convertToASCIIDumbLossless("an"),
"an"
);
// test up to four bytes
$this->assertIdentical(
HTMLPurifier_Encoder::convertToASCIIDumbLossless("\xF3\xA0\x80\xA0"),
"&#917536;"
);
}
function assertASCIISupportCheck($enc, $ret) {
$test = HTMLPurifier_Encoder::testEncodingSupportsASCII($enc, true);
if ($test === false) return;
@@ -159,14 +159,14 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
$ret
);
}
function test_testEncodingSupportsASCII() {
$this->assertASCIISupportCheck('Shift_JIS', array("\xC2\xA5" => '\\', "\xE2\x80\xBE" => '~'));
$this->assertASCIISupportCheck('JOHAB', array("\xE2\x82\xA9" => '\\'));
$this->assertASCIISupportCheck('ISO-8859-1', array());
$this->assertASCIISupportCheck('dontexist', array()); // canary
}
function testShiftJIS() {
if (!function_exists('iconv')) return;
$this->config->set('Core', 'Encoding', 'Shift_JIS');
@@ -180,6 +180,6 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
'\\~'
);
}
}