[Pkg-javascript-commits] [ltx] 03/25: add test case for bug #101

Jonas Smedegaard dr at jones.dk
Tue Jan 10 18:21:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository ltx.

commit c12e4f26f60ec54788ebf8491e133f6639897218
Author: Astro <astro at spaceboyz.net>
Date:   Thu Nov 3 19:46:22 2016 +0100

    add test case for bug #101
---
 lib/parsers/ltx.js |  2 +-
 test/parse-test.js | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/lib/parsers/ltx.js b/lib/parsers/ltx.js
index 4ba23d2..129af8d 100644
--- a/lib/parsers/ltx.js
+++ b/lib/parsers/ltx.js
@@ -60,7 +60,7 @@ var SaxLtx = module.exports = function SaxLtx () {
 
     for (; pos < data.length; pos++) {
       var c = data.charCodeAt(pos)
-      // console.log("state", state, "c", c, data[pos])
+      console.log("state", state, "c", c, data[pos])
       switch (state) {
         case STATE_TEXT:
           if (c === 60 /* < */) {
diff --git a/test/parse-test.js b/test/parse-test.js
index 51fa16a..ba70825 100644
--- a/test/parse-test.js
+++ b/test/parse-test.js
@@ -156,6 +156,24 @@ parsers.forEach(function (Parser) {
             xmlns: 'urn:ietf:params:xml:ns:xmpp-sasl'
           }
         })
+      },
+      'bug: elements in comments': function () {
+        var parser = new Parser()
+        var events = []
+        parser.on('startElement', function (name, attrs) {
+          events.push({ start: name, attrs: attrs })
+        })
+        parser.on('endElement', function (name) {
+          events.push({ end: name })
+        })
+        parser.on('comment', function (s) {
+          events.push({ comment: s })
+        })
+        parser.write("<?xml version='1.0'?><!-- <foo></foo><bar></bar> --><root></root>");
+          assert.deepEqual(events, [
+              { start: 'root' , attrs: {} },
+              { end: 'root' }
+          ]);
       }
     }
   }).export(module)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git



More information about the Pkg-javascript-commits mailing list