aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_stanza_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2024-11-17 12:35:51 +0100
committerKim Alvefur <zash@zash.se>2024-11-17 12:35:51 +0100
commit00584c4d610a381e4181ab438102420aa601f310 (patch)
treede12daeaa27fe176dc0343df2347b6cd9c1619de /spec/util_stanza_spec.lua
parentb9f73bc7240b87e537f141cf0a4f4c1bef219c3e (diff)
downloadprosody-00584c4d610a381e4181ab438102420aa601f310.tar.gz
prosody-00584c4d610a381e4181ab438102420aa601f310.zip
util.stanza: Handle namespace prefixes for attributes in :find()
More correct handling of namespaces here. This works with both prefixes from the parser and hacky .attr["foo:bar"]
Diffstat (limited to 'spec/util_stanza_spec.lua')
-rw-r--r--spec/util_stanza_spec.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua
index e11c70dd..cabb27bf 100644
--- a/spec/util_stanza_spec.lua
+++ b/spec/util_stanza_spec.lua
@@ -577,5 +577,9 @@ describe("util.stanza", function()
assert.equal("text", s:find("{urn:example:not:same}child/nested#"), "finds nested text")
assert.is_nil(s:find("child"), "respects namespaces")
end);
+ it("handles namespaced attributes", function()
+ local s = st.stanza("root", { ["urn:example:namespace\1attr"] = "value" }, { e = "urn:example:namespace" });
+ assert.equal("value", s:find("@e:attr"), "finds prefixed attr")
+ end)
end);
end);