spec/util_xml_spec.lua
changeset 8239 4878e4159e12
child 12184 53e0ae770917
equal deleted inserted replaced
8238:7d9a2c200736 8239:4878e4159e12
       
     1 
       
     2 local xml = require "util.xml";
       
     3 
       
     4 describe("util.xml", function()
       
     5 	describe("#parse()", function()
       
     6 		it("should work", function()
       
     7 			local x =
       
     8 [[<x xmlns:a="b">
       
     9 	<y xmlns:a="c"> <!-- this overwrites 'a' -->
       
    10 	    <a:z/>
       
    11 	</y>
       
    12 	<a:z/> <!-- prefix 'a' is nil here, but should be 'b' -->
       
    13 </x>
       
    14 ]]
       
    15 			local stanza = xml.parse(x);
       
    16 			assert.are.equal(stanza.tags[2].attr.xmlns, "b");
       
    17 			assert.are.equal(stanza.tags[2].namespaces["a"], "b");
       
    18 		end);
       
    19 	end);
       
    20 end);