changeset 9741 | 3d6f5b20cca6 |
child 10354 | 75eab21b7968 |
9740:a5ae3f4e1a40 | 9741:3d6f5b20cca6 |
---|---|
1 local template = [[ |
|
2 {greet!}, {name?world}! |
|
3 ]]; |
|
4 local expect1 = [[ |
|
5 Hello, WORLD! |
|
6 ]]; |
|
7 local expect2 = [[ |
|
8 Hello, world! |
|
9 ]]; |
|
10 |
|
11 describe("util.interpolation", function () |
|
12 it("renders", function () |
|
13 local render = require "util.interpolation".new("%b{}", string.upper); |
|
14 assert.equal(expect1, render(template, { greet = "Hello", name = "world" })); |
|
15 assert.equal(expect2, render(template, { greet = "Hello" })); |
|
16 end); |
|
17 end); |