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
commit686adb2d713f0a1b5f8ec27221fcf00f6ece886f (patch)
tree141fc776099fc49449cc0ba4c64fedd45d2fc87b /spec/util_interpolation_spec.lua
parent0ca2e88384f6ec512879cf4cfbe2627b984762d5 (diff)
downloadprosody-686adb2d713f0a1b5f8ec27221fcf00f6ece886f.tar.gz
prosody-686adb2d713f0a1b5f8ec27221fcf00f6ece886f.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);