Mercurial > prosody-hg
comparison spec/util_xml_spec.lua @ 8236:4878e4159e12
Port tests to the `busted` test runner
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Fri, 15 Sep 2017 17:07:57 -0400 |
| parents | |
| children | 53e0ae770917 |
comparison
equal
deleted
inserted
replaced
| 8235:7d9a2c200736 | 8236: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); |
