diff options
Diffstat (limited to 'test/HTML5/Parser/TokenizerTest.php')
-rw-r--r-- | test/HTML5/Parser/TokenizerTest.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php index c31d74b..cae2adb 100644 --- a/test/HTML5/Parser/TokenizerTest.php +++ b/test/HTML5/Parser/TokenizerTest.php @@ -102,6 +102,8 @@ class TokenizerTest extends \HTML5\Tests\TestCase { '</test>' => 'test', '</test >' => 'test', + '</thisIsTheTagThatDoesntEndItJustGoesOnAndOnMyFriend>' => + 'thisIsTheTagThatDoesntEndItJustGoesOnAndOnMyFriend', // See 8.2.4.10, which requires this and does not say error. '</a<b>' => 'a<b', ); @@ -114,12 +116,12 @@ class TokenizerTest extends \HTML5\Tests\TestCase { } + // Recoverable failures $fail = array( '</a class="monkey">' => 'a', '</a <b>' => 'a', - '</ a>' => 'a', - '</>' => '', - '</ >' => '', + '</a <b <c>' => 'a', + '</a is the loneliest letter>' => 'a', ); foreach ($fail as $test => $result) { $events = $this->parse($test); @@ -132,5 +134,23 @@ class TokenizerTest extends \HTML5\Tests\TestCase { $this->assertEquals($result, $e1['data'][0], "Parse end tag " . $test); $this->assertEquals(3, $events->depth()); } + + // BogoComments + $comments = array( + '</>' => '</>', + '</ >' => '</ >', + '</ a>' => '</ a>', + ); + foreach ($comments as $test => $result) { + $events = $this->parse($test); + // Should have triggered an error. + $e0 = $events->get(0); + $this->assertEquals('error', $e0['name'], "Parsing $test expects a leading error." . print_r($events, TRUE)); + // Should have tried to parse anyway. + $e1 = $events->get(1); + $this->assertEquals('comment', $e1['name'], "Parsing $test expects comment." . print_r($events, TRUE)); + $this->assertEquals($result, $e1['data'][0], "Parse end tag " . $test); + $this->assertEquals(3, $events->depth()); + } } } |