Mercurial > prosody-hg
comparison spec/util_datamapper_spec.lua @ 11468:348b191cd850
util.datamapper: Complete array building support
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 20 Mar 2021 21:29:51 +0100 |
| parents | c098d07e6717 |
| children | 83e127eb91f9 |
comparison
equal
deleted
inserted
replaced
| 11467:88792dd2bee9 | 11468:348b191cd850 |
|---|---|
| 179 end | 179 end |
| 180 end | 180 end |
| 181 assert.equal(#x.tags-1, #u.tags) | 181 assert.equal(#x.tags-1, #u.tags) |
| 182 | 182 |
| 183 end); | 183 end); |
| 184 | |
| 185 it("handles arrays", function () | |
| 186 local u = map.unparse(disco_schema, disco); | |
| 187 assert.equal("urn:example:feature:1", u:find("{http://jabber.org/protocol/disco#info}query/feature/@var")) | |
| 188 local n = 0; | |
| 189 for child in u:get_child("query", "http://jabber.org/protocol/disco#info"):childtags("feature") do | |
| 190 n = n + 1; | |
| 191 assert.equal(string.format("urn:example:feature:%d", n), child.attr.var); | |
| 192 end | |
| 193 end); | |
| 194 | |
| 184 end); | 195 end); |
| 185 end) | 196 end) |
