Comparison

spec/util_stanza_spec.lua @ 8598:282d544d48f4

util.stanza: Add tests ensuring support for unicode in tag/attr names
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Mar 2018 14:50:28 +0000
parent 8597:6e5fbeaca0f4
child 8599:62bfc85a53c8
comparison
equal deleted inserted replaced
8597:6e5fbeaca0f4 8598:282d544d48f4
59 assert.are.equal(#s1, 3); 59 assert.are.equal(#s1, 3);
60 assert.are.equal(s1.tags[1].name, "child1"); 60 assert.are.equal(s1.tags[1].name, "child1");
61 assert.are.equal(s1.tags[2].name, "child2"); 61 assert.are.equal(s1.tags[2].name, "child2");
62 assert.are.equal(#s1.tags[1], 1); 62 assert.are.equal(#s1.tags[1], 1);
63 assert.are.equal(s1.tags[1][1].name, "grandchild1"); 63 assert.are.equal(s1.tags[1][1].name, "grandchild1");
64 end);
65 it("should work with unicode values", function ()
66 local s = st.stanza("Объект", { xmlns = "myxmlns", ["Объект"] = "&" });
67 assert.are.equal(s.name, "Объект");
68 assert.are.equal(s.attr.xmlns, "myxmlns");
69 assert.are.equal(s.attr["Объект"], "&");
64 end); 70 end);
65 end); 71 end);
66 72
67 describe("#message()", function() 73 describe("#message()", function()
68 it("should work", function() 74 it("should work", function()