From 15d5dffa63b71c75bcba23046ac20e4a7f0e3a58 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 10 Mar 2018 19:58:41 +0100 Subject: spec: Stub tests for util.interpolation --- spec/util_interpolation_spec.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/util_interpolation_spec.lua (limited to 'spec/util_interpolation_spec.lua') diff --git a/spec/util_interpolation_spec.lua b/spec/util_interpolation_spec.lua new file mode 100644 index 00000000..88d9f844 --- /dev/null +++ b/spec/util_interpolation_spec.lua @@ -0,0 +1,17 @@ +local template = [[ +{greet!}, {name?world}! +]]; +local expect1 = [[ +Hello, WORLD! +]]; +local expect2 = [[ +Hello, world! +]]; + +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" })); + end); +end); -- cgit v1.2.3