Comparison

spec/util_xtemplate_spec.lua @ 13499:1f93e4f78c53

util.xtemplate: Fix error on applying each() to zero stanzas
author Kim Alvefur <zash@zash.se>
date Thu, 11 Jul 2024 15:04:29 +0200
parent 13404:034c7af177f0
child 13568:3615590fd9ed
comparison
equal deleted inserted replaced
13498:aefbc76ac8d2 13499:1f93e4f78c53
36 local x = st.stanza("root"):tag("foo"):tag("bar") 36 local x = st.stanza("root"):tag("foo"):tag("bar")
37 for i = 1, 5 do x:text_tag("i", tostring(i)); end 37 for i = 1, 5 do x:text_tag("i", tostring(i)); end
38 x:reset(); 38 x:reset();
39 assert.same("12345", xtemplate.render("{foo/bar|each(i){{#}}}", x)); 39 assert.same("12345", xtemplate.render("{foo/bar|each(i){{#}}}", x));
40 end) 40 end)
41 it("handles missing inputs", function ()
42 local x = st.stanza("root");
43 assert.same("", xtemplate.render("{foo/bar|each(i){{#}}}", x));
44 end)
41 end) 45 end)
42 end) 46 end)
43 end) 47 end)