Skip to content

Commit

Permalink
Rewrote tests to work with the zap test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonidas-from-XIV committed Apr 15, 2011
1 parent 3fd3a33 commit 2ce924a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions test/xml2js.test.js
@@ -1,11 +1,13 @@
// use zap to run the tests
var xml2js = require('xml2js'),
fs = require('fs'),
sys = require('sys');
sys = require('sys'),
assert = require('assert');

module.exports = {
'test default parse' : function(assert) {
'test default parse' : function(test) {
var x2js = new xml2js.Parser();
assert.isNotUndefined(x2js);
//assert.isNotUndefined(x2js);
x2js.addListener('end', function(r) {
console.log('Result object: ' + sys.inspect(r, false, 10));
assert.equal(r['chartest']['@']['desc'], "Test for CHARs");
Expand All @@ -22,15 +24,16 @@ module.exports = {
assert.equal(r['listtest']['item'][0]['subitem'][3], "Foo(4)");
assert.equal(r['listtest']['item'][1], "Qux.");
assert.equal(r['listtest']['item'][2], "Quux.");
test.finish();
});
fs.readFile(__dirname + '/fixtures/sample.xml', function(err, data) {
assert.isNull(err);
//assert.isNull(err);
x2js.parseString(data);
});
},
'test parse EXPLICIT_CHARKEY' : function(assert) {
'test parse EXPLICIT_CHARKEY' : function(test) {
var x2js = new xml2js.Parser();
assert.isNotUndefined(x2js);
//assert.isNotUndefined(x2js);
x2js.EXPLICIT_CHARKEY = true;
x2js.addListener('end', function(r) {
assert.equal(r['chartest']['@']['desc'], "Test for CHARs");
Expand All @@ -47,9 +50,10 @@ module.exports = {
assert.equal(r['listtest']['item'][0]['subitem'][3]['#'], "Foo(4)");
assert.equal(r['listtest']['item'][1]['#'], "Qux.");
assert.equal(r['listtest']['item'][2]['#'], "Quux.");
test.finish();
});
fs.readFile(__dirname + '/fixtures/sample.xml', function(err, data) {
assert.isNull(err);
//assert.isNull(err);
x2js.parseString(data);
});
}
Expand Down

0 comments on commit 2ce924a

Please sign in to comment.