Software /
code /
prosody
Comparison
spec/util_interpolation_spec.lua @ 10061:5c71693c8345
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 08 Jul 2019 02:44:32 +0200 |
parent | 9737:3d6f5b20cca6 |
child | 10350:75eab21b7968 |
comparison
equal
deleted
inserted
replaced
10060:7a36b7ac309b | 10061:5c71693c8345 |
---|---|
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); |