aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/sxml/xml-namespace.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-16 20:33:16 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-16 20:33:16 +0200
commit551828bd29652c5779ecf1e7fbb8278c87c203d8 (patch)
tree60dcfb3c721fc9cbd5f47a48d3e5c170ff00e96f /tests/unit/sxml/xml-namespace.scm
parentAdd tests for (hnh util type) (diff)
downloadcalp-551828bd29652c5779ecf1e7fbb8278c87c203d8.tar.gz
calp-551828bd29652c5779ecf1e7fbb8278c87c203d8.tar.xz
Move sxml tests to own "namespace".
Diffstat (limited to 'tests/unit/sxml/xml-namespace.scm')
-rw-r--r--tests/unit/sxml/xml-namespace.scm38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/unit/sxml/xml-namespace.scm b/tests/unit/sxml/xml-namespace.scm
new file mode 100644
index 00000000..2b6ea174
--- /dev/null
+++ b/tests/unit/sxml/xml-namespace.scm
@@ -0,0 +1,38 @@
+(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))))
+
+'((sxml namespace))