Software /
code /
prosody
Changeset
11065:95eb1a981ef6
util.interpolation: Add test for ~ when value is false (not just nil)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 09 Sep 2020 17:12:00 +0100 |
parents | 11064:af1e3b7d9ea3 |
children | 11066:dc41c8dfd2b1 |
files | spec/util_interpolation_spec.lua |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/spec/util_interpolation_spec.lua Wed Sep 09 17:10:33 2020 +0100 +++ b/spec/util_interpolation_spec.lua Wed Sep 09 17:12:00 2020 +0100 @@ -33,13 +33,16 @@ 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 @@ 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);