File: 93.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 (48 lines) | stat: -rw-r--r-- 1,389 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
suite 'Tests specific to issues:', ->
  test 'Issue #93 (Auto-generating arrays)', ->
    obj =
        root:
            Title:
                '@lang': 'eng'
                '#text': 'Show Title'
            Cast: [
                {
                    '@role': 'Host'
                    '#text': 'Interview Person'
                }
                {
                    '@role': 'Guest'
                    '#text': 'Guest Person'
                }
            ]
            Category: [
                {
                    '@lang': 'eng'
                    '@type': 'B23'
                    '#text': 'Game Show'
                }
                {
                    '@lang': 'eng'
                    '@type': 'C34'
                    '#text': 'Family'
                }
                {
                    '@lang': 'eng'
                    '@type': 'B23'
                    '#text': 'Topical'
                }
            ]

    eq(
      xml(obj).end()
      '<?xml version="1.0"?>' +
      '<root>' +
        '<Title lang="eng">Show Title</Title>' +
        '<Cast role="Host">Interview Person</Cast>' +
        '<Cast role="Guest">Guest Person</Cast>' +
        '<Category lang="eng" type="B23">Game Show</Category>' +
        '<Category lang="eng" type="C34">Family</Category>' +
        '<Category lang="eng" type="B23">Topical</Category>' +
      '</root>'
    )