# HG changeset patch # User Matthew Wild # Date 1599667920 -3600 # Node ID 95eb1a981ef674849d8008f6ef8bdf3ce9c51a9f # Parent af1e3b7d9ea3e8cd4dc274953b51d6ac663ba9f5 util.interpolation: Add test for ~ when value is false (not just nil) diff -r af1e3b7d9ea3 -r 95eb1a981ef6 spec/util_interpolation_spec.lua --- 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);