aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_xml_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/util_xml_spec.lua')
-rw-r--r--spec/util_xml_spec.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/util_xml_spec.lua b/spec/util_xml_spec.lua
new file mode 100644
index 00000000..11820894
--- /dev/null
+++ b/spec/util_xml_spec.lua
@@ -0,0 +1,20 @@
+
+local xml = require "util.xml";
+
+describe("util.xml", function()
+ describe("#parse()", function()
+ it("should work", function()
+ local x =
+[[<x xmlns:a="b">
+ <y xmlns:a="c"> <!-- this overwrites 'a' -->
+ <a:z/>
+ </y>
+ <a:z/> <!-- prefix 'a' is nil here, but should be 'b' -->
+</x>
+]]
+ local stanza = xml.parse(x);
+ assert.are.equal(stanza.tags[2].attr.xmlns, "b");
+ assert.are.equal(stanza.tags[2].namespaces["a"], "b");
+ end);
+ end);
+end);