File: node.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 (28 lines) | stat: -rw-r--r-- 902 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
suite 'Node Guards:', ->
  test 'Invalid operations', ->
    testCases = [
      () -> xml('test').insertBefore()
      () -> xml('test').insertAfter()
      () -> xml('test').remove()
      () -> xml('test').up()
      () -> xml('test').ele('first').prev()
      () -> xml('test').ele('first').up().ele('last').next()
      () -> xml('root').ele([])
    ]

    results = [
      "Cannot insert elements at root level. parent: <?xml>"
      "Cannot insert elements at root level. parent: <?xml>"
      "Cannot remove the root element. parent: <?xml>"
      "The root node has no parent. Use doc() if you need to get the document object."
      "Already at the first node. parent: <?xml>"
      "Already at the last node. parent: <?xml>"
      "Could not create any elements with: . parent: <?xml>"
    ]

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