aboutsummaryrefslogtreecommitdiff
path: root/tests/test/xml-namespace.scm
blob: 09402cebde7aa434245d61e23d36f770e222fc0a (plain)
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
(define-module (test xml-namespace)
  :use-module (srfi srfi-64)
  :use-module (srfi srfi-88)
  :use-module ((sxml namespace) :select (move-to-namespace)))

(test-equal
  "Move unnamespaced to namespace"
  '(NEW:test)
  (move-to-namespace '(test) '((#f . NEW))))

(test-equal
  "Swap namespaces"
  '(b:a (a:b))
  (move-to-namespace
    '(a:a (b:b))
    '((a . b) (b . a))))

(test-equal
  "Remove all namespaces"
  '(a (b))
  (move-to-namespace '(a:a (b:b)) #f))

(test-equal
  "Move everything to one namespace"
  '(c:a (c:b))
  (move-to-namespace '(a:a (b:b)) 'c))

(test-equal
  "Partial namespace change"
  '(c:a (b:b))
  (move-to-namespace '(a:a (b:b)) '((a . c))))

(test-equal
  "Remove specific namespace"
  '(a:a (b))
  (move-to-namespace '(a:a (b:b)) '((b . #f))))