add tests that make sure buffer boundaries are handled properly for SGML comments

(see SF patch #901369)
This commit is contained in:
Fred Drake 2004-09-08 22:57:01 +00:00
parent 0b4a7d95c3
commit 75d9a62fe0
2 changed files with 26 additions and 0 deletions

View File

@ -243,6 +243,19 @@ DOCTYPE html [
self._run_check(["<a b='>", "'>"], output) self._run_check(["<a b='>", "'>"], output)
self._run_check(["<a b='>'", ">"], output) self._run_check(["<a b='>'", ">"], output)
output = [("comment", "abc")]
self._run_check(["", "<!--abc-->"], output)
self._run_check(["<", "!--abc-->"], output)
self._run_check(["<!", "--abc-->"], output)
self._run_check(["<!-", "-abc-->"], output)
self._run_check(["<!--", "abc-->"], output)
self._run_check(["<!--a", "bc-->"], output)
self._run_check(["<!--ab", "c-->"], output)
self._run_check(["<!--abc", "-->"], output)
self._run_check(["<!--abc-", "->"], output)
self._run_check(["<!--abc--", ">"], output)
self._run_check(["<!--abc-->", ""], output)
def test_starttag_junk_chars(self): def test_starttag_junk_chars(self):
self._parse_error("</>") self._parse_error("</>")
self._parse_error("</$>") self._parse_error("</$>")

View File

@ -307,6 +307,19 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
self.check_events(["<a b='>", "'>"], output) self.check_events(["<a b='>", "'>"], output)
self.check_events(["<a b='>'", ">"], output) self.check_events(["<a b='>'", ">"], output)
output = [("comment", "abc")]
self._run_check(["", "<!--abc-->"], output)
self._run_check(["<", "!--abc-->"], output)
self._run_check(["<!", "--abc-->"], output)
self._run_check(["<!-", "-abc-->"], output)
self._run_check(["<!--", "abc-->"], output)
self._run_check(["<!--a", "bc-->"], output)
self._run_check(["<!--ab", "c-->"], output)
self._run_check(["<!--abc", "-->"], output)
self._run_check(["<!--abc-", "->"], output)
self._run_check(["<!--abc--", ">"], output)
self._run_check(["<!--abc-->", ""], output)
def _test_starttag_junk_chars(self): def _test_starttag_junk_chars(self):
self.check_parse_error("<") self.check_parse_error("<")
self.check_parse_error("<>") self.check_parse_error("<>")