aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_interpolation_spec.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-09-09 17:12:00 +0100
committerMatthew Wild <mwild1@gmail.com>2020-09-09 17:12:00 +0100
commit86acb2276c938f80b66799284ced24589576d6c0 (patch)
tree141fc776099fc49449cc0ba4c64fedd45d2fc87b /spec/util_interpolation_spec.lua
parentc00bd4515da975d5db8004b2b92809e04aeaec32 (diff)
downloadprosody-86acb2276c938f80b66799284ced24589576d6c0.tar.gz
prosody-86acb2276c938f80b66799284ced24589576d6c0.zip
util.interpolation: Add test for ~ when value is false (not just nil)
Diffstat (limited to 'spec/util_interpolation_spec.lua')
-rw-r--r--spec/util_interpolation_spec.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/util_interpolation_spec.lua b/spec/util_interpolation_spec.lua
index 98ed3b74..614d1f54 100644
--- a/spec/util_interpolation_spec.lua
+++ b/spec/util_interpolation_spec.lua
@@ -33,13 +33,16 @@ local expect_map = [[
FOO: bar
]]
local template_not = [[
-{thing~Thing is nil}{thing&Thing is not nil}
+{thing~Thing is falsy}{thing&Thing is truthy}
]]
local expect_not_true = [[
-Thing is not nil
+Thing is truthy
]]
local expect_not_nil = [[
-Thing is nil
+Thing is falsy
+]]
+local expect_not_false = [[
+Thing is falsy
]]
describe("util.interpolation", function ()
it("renders", function ()
@@ -53,5 +56,6 @@ describe("util.interpolation", function ()
assert.equal(expect_map, render(template_map, { foo = { foo = "bar" } }));
assert.equal(expect_not_true, render(template_not, { thing = true }));
assert.equal(expect_not_nil, render(template_not, { thing = nil }));
+ assert.equal(expect_not_false, render(template_not, { thing = false }));
end);
end);