summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2004-09-08 22:57:01 (GMT)
committerFred Drake <fdrake@acm.org>2004-09-08 22:57:01 (GMT)
commit75d9a62fe031195742b6d9f0647458af0fbd96f0 (patch)
tree89ab82f905a8c277e7ba36345faaf057c11e0f03 /Lib
parent0b4a7d95c30b07bd23011079d29545fa77917405 (diff)
downloadcpython-75d9a62fe031195742b6d9f0647458af0fbd96f0.zip
cpython-75d9a62fe031195742b6d9f0647458af0fbd96f0.tar.gz
cpython-75d9a62fe031195742b6d9f0647458af0fbd96f0.tar.bz2
add tests that make sure buffer boundaries are handled properly for SGML comments
(see SF patch #901369)
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/test/test_htmlparser.py13
-rw-r--r--Lib/test/test_sgmllib.py13
2 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
index ffd3ebc..4cb87df 100755
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -243,6 +243,19 @@ DOCTYPE html [
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):
self._parse_error("</>")
self._parse_error("</$>")
diff --git a/Lib/test/test_sgmllib.py b/Lib/test/test_sgmllib.py
index 6a77e07..bc25bd0 100644
--- a/Lib/test/test_sgmllib.py
+++ b/Lib/test/test_sgmllib.py
@@ -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)
+ 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):
self.check_parse_error("<")
self.check_parse_error("<>")