aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_interpolation_spec.lua
blob: 88d9f8445bf5145cd7eefab6d9beba0c35f6f6bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);