1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-01 11:50:28 +02:00

[2.0.1] Normalize newlines to \n for internal processing.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1235 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-06-25 19:18:55 +00:00
parent 9f996b125a
commit 6f5592ae60
8 changed files with 35 additions and 22 deletions

View File

@@ -38,10 +38,11 @@ class HTMLPurifier_ChildDef_TableTest extends HTMLPurifier_ChildDefHarness
// whitespace sticks to the previous element, last whitespace is
// stationary
$this->assertResult("\n <tr />\n <tr />\n ");
$this->assertResult("\n <tr />\n <tr />\n ", true, array('Output.Newline' => "\n"));
$this->assertResult(
"\n\t<tbody />\n\t\t<tfoot />\n\t\t\t",
"\n\t\t<tfoot />\n\t<tbody />\n\t\t\t"
"\n\t\t<tfoot />\n\t<tbody />\n\t\t\t",
array('Output.Newline' => "\n")
);
}

View File

@@ -207,6 +207,7 @@ class HTMLPurifier_GeneratorTest extends HTMLPurifier_Harness
$this->config = HTMLPurifier_Config::createDefault();
$this->config->set('Core', 'TidyFormat', true);
$this->config->set('Output', 'Newline', "\n");
// nice wrapping please
$this->assertGeneration(

View File

@@ -72,32 +72,23 @@ class HTMLPurifier_Lexer_DirectLexTest extends UnitTestCase
function testLineNumbers() {
$html = '<b>Line 1</b>
<i>Line 2</i>
Still Line 2<br
/>Now Line 4
<br />';
$html = "<b>Line 1</b>\n<i>Line 2</i>\nStill Line 2<br\n/>Now Line 4\n\n<br />";
$expect = array(
// line 1
0 => new HTMLPurifier_Token_Start('b')
,1 => new HTMLPurifier_Token_Text('Line 1')
,2 => new HTMLPurifier_Token_End('b')
,3 => new HTMLPurifier_Token_Text('
')
,3 => new HTMLPurifier_Token_Text("\n")
// line 2
,4 => new HTMLPurifier_Token_Start('i')
,5 => new HTMLPurifier_Token_Text('Line 2')
,6 => new HTMLPurifier_Token_End('i')
,7 => new HTMLPurifier_Token_Text('
Still Line 2')
,7 => new HTMLPurifier_Token_Text("\nStill Line 2")
// line 3
,8 => new HTMLPurifier_Token_Empty('br')
// line 4
,9 => new HTMLPurifier_Token_Text('Now Line 4
')
,9 => new HTMLPurifier_Token_Text("Now Line 4\n\n")
// line SIX
,10 => new HTMLPurifier_Token_Empty('br')
);