aboutsummaryrefslogtreecommitdiff
path: root/tests/test/xml-namespace.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-03-07 15:31:00 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-03-07 20:29:14 +0100
commitf7716ac1a87649cad96242f2d5bf0a987d7f430c (patch)
treeb4b84951ef468fd644c42e9e0fee535d879f0387 /tests/test/xml-namespace.scm
parentCleanup in (hnh util path). (diff)
downloadcalp-f7716ac1a87649cad96242f2d5bf0a987d7f430c.tar.gz
calp-f7716ac1a87649cad96242f2d5bf0a987d7f430c.tar.xz
Add new tests.
Diffstat (limited to 'tests/test/xml-namespace.scm')
-rw-r--r--tests/test/xml-namespace.scm36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test/xml-namespace.scm b/tests/test/xml-namespace.scm
new file mode 100644
index 00000000..09402ceb
--- /dev/null
+++ b/tests/test/xml-namespace.scm
@@ -0,0 +1,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))))