File: beginwithcallback.coffee

package info (click to toggle)
node-xml2js 0.4.23%2B~cs15.4.0%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,380 kB
  • sloc: xml: 117; javascript: 7; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 872 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
suite 'begin() with callbacks Guards:', ->
  test 'node', ->
    testCases = [
      () -> doc(() ->).node()
      () -> doc(() ->).node('root1').up().node('root2')
      () -> doc(() ->).node('root').ele('node').up().att('att', 'val')
      () -> doc(() ->).node('root').dec()
      () -> doc(() ->).dtd()
      () -> doc(() ->).node('root').dtd('root')
      () -> doc(() ->).node('root').up().up()
    ]

    results = [
      "Missing node name."
      "Document can only have one root node. node: <root2>"
      "att() can only be used immediately after an ele() call in callback mode. node: <att>"
      "declaration() must be the first node."
      "Missing root node name."
      "dtd() must come before the root node."
      "The document node has no parent."
    ]

    err(
      testCases[i]
      Error
      results[i]
    ) for i in [0..testCases.length-1]