util.datamapper: Complete array building support

This commit is contained in:
Kim Alvefur 2021-03-20 21:29:51 +01:00
parent 366edae239
commit 4f191a3239
3 changed files with 17 additions and 24 deletions

View file

@ -181,5 +181,16 @@ describe("util.datampper", function()
assert.equal(#x.tags-1, #u.tags)
end);
it("handles arrays", function ()
local u = map.unparse(disco_schema, disco);
assert.equal("urn:example:feature:1", u:find("{http://jabber.org/protocol/disco#info}query/feature/@var"))
local n = 0;
for child in u:get_child("query", "http://jabber.org/protocol/disco#info"):childtags("feature") do
n = n + 1;
assert.equal(string.format("urn:example:feature:%d", n), child.attr.var);
end
end);
end);
end)