File: 97.coffee

package info (click to toggle)
node-xml2js 0.6.2%2B~cs15.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,312 kB
  • sloc: xml: 119; javascript: 7; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 731 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
obj =
  root:
    '@att': 'attribute value with & and &'
    '#text': 'XML entities for ampersand are & and &.'

suite 'Tests specific to issues:', ->
  test 'Issue #97 (No double encoding)', ->
    eq(
      xml(obj, { noDoubleEncoding: true }).end()
      '<?xml version="1.0"?>' +
      '<root att="attribute value with &amp; and &amp;#38;">' +
        'XML entities for ampersand are &amp; and &amp;#38;.' +
      '</root>'
    )

  test 'Issue #97 (Double encoding - default behavior)', ->
    eq(
      xml(obj).end()
      '<?xml version="1.0"?>' +
      '<root att="attribute value with &amp;amp; and &amp;#38;">' +
        'XML entities for ampersand are &amp;amp; and &amp;#38;.' +
      '</root>'
    )