[libxml2] add test coverage for incorrectly-closed comments



commit e28d9347bce1ba0b41cd27586b10623edb98b72f
Author: Mike Dalessio <mike dalessio gmail com>
Date:   Tue Aug 4 14:53:19 2020 -0400

    add test coverage for incorrectly-closed comments
    
    this establishes the baseline behavior so that subsequent commits
    which modify this behavior are clear about what's being changed.

 result/HTML/comments.html      | 15 +++++++++++++++
 result/HTML/comments.html.err  |  0
 result/HTML/comments.html.sax  | 42 ++++++++++++++++++++++++++++++++++++++++++
 result/HTML/comments2.html     | 14 ++++++++++++++
 result/HTML/comments2.html.err |  4 ++++
 result/HTML/comments2.html.sax | 33 +++++++++++++++++++++++++++++++++
 test/HTML/comments.html        | 14 ++++++++++++++
 test/HTML/comments2.html       | 14 ++++++++++++++
 8 files changed, 136 insertions(+)
---
diff --git a/result/HTML/comments.html b/result/HTML/comments.html
new file mode 100644
index 00000000..47805c99
--- /dev/null
+++ b/result/HTML/comments.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd";>
+<html>
+  <body>
+    <div>
+      <h3>
+        <a href="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment";>
+          Incorrectly closed comment
+        </a>
+      </h3>
+      <div>
+        <!--incorrectly closed comment--!><span id=under-test>whatwg guidance is that this should be a DOM 
node</span><!--correctly closed comment-->
+      </div>
+    </div>
+  </body>
+</html>
diff --git a/result/HTML/comments.html.err b/result/HTML/comments.html.err
new file mode 100644
index 00000000..e69de29b
diff --git a/result/HTML/comments.html.sax b/result/HTML/comments.html.sax
new file mode 100644
index 00000000..caf727b0
--- /dev/null
+++ b/result/HTML/comments.html.sax
@@ -0,0 +1,42 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(html)
+SAX.characters(
+  , 3)
+SAX.startElement(body)
+SAX.characters(
+    , 5)
+SAX.startElement(div)
+SAX.characters(
+      , 7)
+SAX.startElement(h3)
+SAX.characters(
+        , 9)
+SAX.startElement(a, 
href='https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment')
+SAX.characters(
+          Incorrectly closed , 46)
+SAX.endElement(a)
+SAX.characters(
+      , 7)
+SAX.endElement(h3)
+SAX.characters(
+      , 7)
+SAX.startElement(div)
+SAX.characters(
+        , 9)
+SAX.comment(incorrectly closed comment--!><span id=under-test>whatwg guidance is that this should be a DOM 
node</span><!--correctly closed comment)
+SAX.characters(
+      , 7)
+SAX.endElement(div)
+SAX.characters(
+    , 5)
+SAX.endElement(div)
+SAX.characters(
+  , 3)
+SAX.endElement(body)
+SAX.characters(
+, 1)
+SAX.endElement(html)
+SAX.characters(
+, 1)
+SAX.endDocument()
diff --git a/result/HTML/comments2.html b/result/HTML/comments2.html
new file mode 100644
index 00000000..dd71d0b5
--- /dev/null
+++ b/result/HTML/comments2.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd";>
+<html>
+  <body>
+    <div>
+      <h3>
+        <a href="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment";>
+          Incorrectly closed comment without a correctly closed comment
+        </a>
+      </h3>
+      <div>
+        </div>
+</div>
+</body>
+</html>
diff --git a/result/HTML/comments2.html.err b/result/HTML/comments2.html.err
new file mode 100644
index 00000000..b16216b7
--- /dev/null
+++ b/result/HTML/comments2.html.err
@@ -0,0 +1,4 @@
+./test/HTML/comments2.html:15: HTML parser error : Comment not terminated 
+<!--incorrectly closed comment--!><span id=under-test>
+
+^
diff --git a/result/HTML/comments2.html.sax b/result/HTML/comments2.html.sax
new file mode 100644
index 00000000..77ce9d82
--- /dev/null
+++ b/result/HTML/comments2.html.sax
@@ -0,0 +1,33 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(html)
+SAX.characters(
+  , 3)
+SAX.startElement(body)
+SAX.characters(
+    , 5)
+SAX.startElement(div)
+SAX.characters(
+      , 7)
+SAX.startElement(h3)
+SAX.characters(
+        , 9)
+SAX.startElement(a, 
href='https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment')
+SAX.characters(
+          Incorrectly closed , 81)
+SAX.endElement(a)
+SAX.characters(
+      , 7)
+SAX.endElement(h3)
+SAX.characters(
+      , 7)
+SAX.startElement(div)
+SAX.characters(
+        , 9)
+SAX.error: Comment not terminated 
+<!--incorrectly closed comment--!><span id=under-test>
+SAX.endElement(div)
+SAX.endElement(div)
+SAX.endElement(body)
+SAX.endElement(html)
+SAX.endDocument()
diff --git a/test/HTML/comments.html b/test/HTML/comments.html
new file mode 100644
index 00000000..a0d336b8
--- /dev/null
+++ b/test/HTML/comments.html
@@ -0,0 +1,14 @@
+<html>
+  <body>
+    <div>
+      <h3>
+        <a href="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment";>
+          Incorrectly closed comment
+        </a>
+      </h3>
+      <div>
+        <!--incorrectly closed comment--!><span id=under-test>whatwg guidance is that this should be a DOM 
node</span><!--correctly closed comment-->
+      </div>
+    </div>
+  </body>
+</html>
diff --git a/test/HTML/comments2.html b/test/HTML/comments2.html
new file mode 100644
index 00000000..207e649a
--- /dev/null
+++ b/test/HTML/comments2.html
@@ -0,0 +1,14 @@
+<html>
+  <body>
+    <div>
+      <h3>
+        <a href="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment";>
+          Incorrectly closed comment without a correctly closed comment
+        </a>
+      </h3>
+      <div>
+        <!--incorrectly closed comment--!><span id=under-test>whatwg guidance is that this should be a DOM 
node</span>
+      </div>
+    </div>
+  </body>
+</html>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]