diff options
author | Technosophos <[email protected]> | 2013-04-19 17:12:54 -0500 |
---|---|---|
committer | Technosophos <[email protected]> | 2013-04-19 17:12:54 -0500 |
commit | 4e5458898e6d9a73d3eae7b3213187407a940ce8 (patch) | |
tree | 2e4c6d5f79ca14574b9ac83e6e36ddb9f5f1904a /test/HTML5/Parser | |
parent | bdbd0e7dabcc7f0567fa5abcb40a5236fc204eb8 (diff) |
Added support for raw text.
Diffstat (limited to 'test/HTML5/Parser')
-rw-r--r-- | test/HTML5/Parser/TokenizerTest.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php index aff819e..69f90b9 100644 --- a/test/HTML5/Parser/TokenizerTest.php +++ b/test/HTML5/Parser/TokenizerTest.php @@ -387,6 +387,35 @@ class TokenizerTest extends \HTML5\Tests\TestCase { } } + public function testRawText() { + $good = array( + '<pre>abcd efg hijk lmnop</pre> ' => 'abcd efg hijk lmnop', + '<pre><not/><the/><tag></pre>' => '<not/><the/><tag>', + '<pre><<<<<<<<</pre>' => '<<<<<<<<', + '<pre>hello</pre</pre>' => 'hello</pre', + "<pre>\nhello</pre\n</pre>" => "\nhello</pre\n", + '<pre>&</pre>' => '&', + ); + foreach ($good as $test => $expects) { + list($tok, $events) = $this->createTokenizer($test); + + $tok->setTextMode(Tokenizer::TEXTMODE_RAW, 'pre'); + $tok->parse(); + + //fprintf(STDOUT, "Test: %s\n", $test); + fprintf(STDOUT, "Test: %s %s\n", $test, print_r($events, TRUE)); + + $this->assertEventEquals('startTag', 'pre', $events->get(0)); + $this->assertEventEquals('text', $expects, $events->get(1)); + $this->assertEventEquals('endTag', 'pre', $events->get(2)); + } + + $bad = array( + '<pre>&</pre' => '&', + ); + + } + public function testText() { $good = array( 'a<br>b', |