diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-08-24 19:40:36 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-08-24 19:40:36 +0200 |
commit | 9b56ebd22e3267cedc839e11ee31d69928214ce5 (patch) | |
tree | 2ae82115a4de42cc37c37dc3a9392976928302a4 /tests/xml-namespace.scm | |
parent | Add tests for iCal unknown key warnings. (diff) | |
download | calp-9b56ebd22e3267cedc839e11ee31d69928214ce5.tar.gz calp-9b56ebd22e3267cedc839e11ee31d69928214ce5.tar.xz |
Allow partial change and removal of XML Namespaces.
Changing the error to a returnu allows a partial namespace change map,
which can sometimes be usefull (and should hopefully not lead to any
issues here).
Changing assoc-ref to assoc allows the removal of namespaces, since
assoc-ref can't differentiate between a match with #f in its cdr, and no
match.
(assoc-ref '((a . #f)) 'a) ⇒ #f
(assoc-ref '((a . #f)) 'b) ⇒ #f
Diffstat (limited to 'tests/xml-namespace.scm')
-rw-r--r-- | tests/xml-namespace.scm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/xml-namespace.scm b/tests/xml-namespace.scm new file mode 100644 index 00000000..74053fd8 --- /dev/null +++ b/tests/xml-namespace.scm @@ -0,0 +1,30 @@ +(((sxml namespace) + 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)))) |