[Pkg-javascript-commits] [node-expat] 293/371: More refactor, add 'debug'
Jonas Smedegaard
dr at jones.dk
Sun Feb 28 10:00:22 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-expat.
commit 63ef9e40c1d22245f4660e413da0892a0ca16b70
Author: Lloyd Watkin <lloyd.watkin at surevine.com>
Date: Mon Nov 24 13:42:51 2014 +0000
More refactor, add 'debug'
---
test/index.js | 56 +++++++++++++++++++++++++++++++-------------------------
1 file changed, 31 insertions(+), 25 deletions(-)
diff --git a/test/index.js b/test/index.js
index 662d4af..f65e421 100644
--- a/test/index.js
+++ b/test/index.js
@@ -1,31 +1,33 @@
-var expat = require('../lib/node-expat');
-var Iconv = require('iconv').Iconv;
-var Buffer = require('buffer').Buffer;
-var vows = require('vows');
-var assert = require('assert');
-var fs = require('fs');
+var expat = require('../lib/node-expat')
+ , Iconv = require('iconv').Iconv
+ , Buffer = require('buffer').Buffer
+ , vows = require('vows')
+ , assert = require('assert')
+ , fs = require('fs')
+ , log = require('debug')('test/index')
function collapseTexts(evs) {
- var r = [];
- var t = "";
+ var r = []
+ var t = ''
evs.forEach(function(ev) {
- if (ev[0] == 'text')
- t += ev[1];
- else {
- if (t != "")
- r.push(['text', t]);
- t = "";
- r.push(ev);
- }
- });
- if (t != "")
- r.push(['text', t]);
- return r;
+ if (ev[0] == 'text') {
+ t += ev[1]
+ } else {
+ if (t != '')
+ r.push([ 'text', t ])
+ t = ''
+ r.push(ev)
+ }
+ })
+ if (t != '') {
+ r.push([ 'text', t ])
+ }
+ return r
}
function expect(s, evs_expected) {
- for(var step = s.length; step > 0; step--) {
- expectWithParserAndStep(s, evs_expected, new expat.Parser(), step);
+ for (var step = s.length; step > 0; step--) {
+ expectWithParserAndStep(s, evs_expected, new expat.Parser(), step)
}
}
@@ -376,17 +378,21 @@ vows.describe('node-expat').addBatch({
var p = expat.createParser()
this.startTags = 0
p.on('startElement', function(name) {
+ log('startElement', name)
this.startTags++
- }.bind(this));
- this.endTags = 0;
+ }.bind(this))
+ this.endTags = 0
p.on('endElement', function(name) {
+ log('endElement', name)
this.endTags++
- }.bind(this));
+ }.bind(this))
p.on('end', function() {
this.ended = true
+ log('ended')
}.bind(this))
p.on('close', function() {
this.closed = true
+ log('closed')
this.callback()
}.bind(this))
p.on('error', function(error) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-expat.git
More information about the Pkg-javascript-commits
mailing list