Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Shortcut for assert.equal

  • Loading branch information...
commit d259a068274874e2e6c5979f1a7322dc06636c36 1 parent df32c23
@Leonidas-from-XIV authored
Showing with 17 additions and 14 deletions.
  1. +17 −14 test/xml2js.test.coffee
View
31 test/xml2js.test.coffee
@@ -40,23 +40,26 @@ validator = (xpath, currentValue, newValue) ->
throw new xml2js.ValidationError("Validation error!")
return newValue
+# shortcut, because it is quite verbose
+equ = assert.equal
+
module.exports =
'test parse with defaults': skeleton(undefined, (r) ->
console.log 'Result object: ' + util.inspect(r, false, 10)
- assert.equal r.sample.chartest[0].$.desc, 'Test for CHARs'
- assert.equal r.sample.chartest[0]._, 'Character data here!'
- assert.equal r.sample.cdatatest[0].$.desc, 'Test for CDATA'
- assert.equal r.sample.cdatatest[0].$.misc, 'true'
- assert.equal r.sample.cdatatest[0]._, 'CDATA here!'
- assert.equal r.sample.nochartest[0].$.desc, 'No data'
- assert.equal r.sample.nochartest[0].$.misc, 'false'
- assert.equal r.sample.listtest[0].item[0]._, '\n This is\n \n character\n \n data!\n \n '
- assert.equal r.sample.listtest[0].item[0].subitem[0], 'Foo(1)'
- assert.equal r.sample.listtest[0].item[0].subitem[1], 'Foo(2)'
- assert.equal r.sample.listtest[0].item[0].subitem[2], 'Foo(3)'
- assert.equal r.sample.listtest[0].item[0].subitem[3], 'Foo(4)'
- assert.equal r.sample.listtest[0].item[1], 'Qux.'
- assert.equal r.sample.listtest[0].item[2], 'Quux.')
+ equ r.sample.chartest[0].$.desc, 'Test for CHARs'
+ equ r.sample.chartest[0]._, 'Character data here!'
+ equ r.sample.cdatatest[0].$.desc, 'Test for CDATA'
+ equ r.sample.cdatatest[0].$.misc, 'true'
+ equ r.sample.cdatatest[0]._, 'CDATA here!'
+ equ r.sample.nochartest[0].$.desc, 'No data'
+ equ r.sample.nochartest[0].$.misc, 'false'
+ equ r.sample.listtest[0].item[0]._, '\n This is\n \n character\n \n data!\n \n '
+ equ r.sample.listtest[0].item[0].subitem[0], 'Foo(1)'
+ equ r.sample.listtest[0].item[0].subitem[1], 'Foo(2)'
+ equ r.sample.listtest[0].item[0].subitem[2], 'Foo(3)'
+ equ r.sample.listtest[0].item[0].subitem[3], 'Foo(4)'
+ equ r.sample.listtest[0].item[1], 'Qux.'
+ equ r.sample.listtest[0].item[2], 'Quux.')
'test parse with explicitCharkey': skeleton(explicitCharkey: true, (r) ->
assert.equal r['chartest']['@']['desc'], 'Test for CHARs'
Please sign in to comment.
Something went wrong with that request. Please try again.