# HG changeset patch # User Kim Alvefur # Date 1571597621 -7200 # Node ID 75eab21b796864320526872565f4db49fde456f8 # Parent ddddda2896fdffff56072946bc11a7a28c40596a util.interpolation: Test #1452 diff -r ddddda2896fd -r 75eab21b7968 spec/util_interpolation_spec.lua --- a/spec/util_interpolation_spec.lua Sun Oct 20 20:53:34 2019 +0200 +++ b/spec/util_interpolation_spec.lua Sun Oct 20 20:53:41 2019 +0200 @@ -1,5 +1,5 @@ local template = [[ -{greet!}, {name?world}! +{greet!?Hi}, {name?world}! ]]; local expect1 = [[ Hello, WORLD! @@ -7,11 +7,15 @@ local expect2 = [[ Hello, world! ]]; +local expect3 = [[ +Hi, YOU! +]]; describe("util.interpolation", function () it("renders", function () local render = require "util.interpolation".new("%b{}", string.upper); assert.equal(expect1, render(template, { greet = "Hello", name = "world" })); assert.equal(expect2, render(template, { greet = "Hello" })); + assert.equal(expect3, render(template, { name = "you" })); end); end);