Software /
code /
prosody
Comparison
spec/util_interpolation_spec.lua @ 9737:3d6f5b20cca6
spec: Stub tests for util.interpolation
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 10 Mar 2018 19:58:41 +0100 |
child | 10350:75eab21b7968 |
comparison
equal
deleted
inserted
replaced
9736:a5ae3f4e1a40 | 9737: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); |