Diff

spec/util_stanza_spec.lua @ 13568:3615590fd9ed

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"]
author Kim Alvefur <zash@zash.se>
date Sun, 17 Nov 2024 12:35:51 +0100
parent 12687:5b69ecaf3427
child 13569:59dacbd637c2
line wrap: on
line diff
--- a/spec/util_stanza_spec.lua	Sat Nov 16 09:20:29 2024 +0100
+++ b/spec/util_stanza_spec.lua	Sun Nov 17 12:35:51 2024 +0100
@@ -577,5 +577,9 @@
 			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);