From 686adb2d713f0a1b5f8ec27221fcf00f6ece886f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 9 Sep 2020 17:12:00 +0100 Subject: util.interpolation: Add test for ~ when value is false (not just nil) --- spec/util_interpolation_spec.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'spec/util_interpolation_spec.lua') 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); -- cgit v1.2.3