Software / code / prosody
Comparison
spec/util_interpolation_spec.lua @ 11308:5d4d90d1eabb
util.interpolation: Add test for #1623
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 25 Jan 2021 21:27:05 +0100 |
| parent | 11065:95eb1a981ef6 |
comparison
equal
deleted
inserted
replaced
| 11307:f2e276bb4ef8 | 11308:5d4d90d1eabb |
|---|---|
| 56 assert.equal(expect_map, render(template_map, { foo = { foo = "bar" } })); | 56 assert.equal(expect_map, render(template_map, { foo = { foo = "bar" } })); |
| 57 assert.equal(expect_not_true, render(template_not, { thing = true })); | 57 assert.equal(expect_not_true, render(template_not, { thing = true })); |
| 58 assert.equal(expect_not_nil, render(template_not, { thing = nil })); | 58 assert.equal(expect_not_nil, render(template_not, { thing = nil })); |
| 59 assert.equal(expect_not_false, render(template_not, { thing = false })); | 59 assert.equal(expect_not_false, render(template_not, { thing = false })); |
| 60 end); | 60 end); |
| 61 it("fixes #1623", function () | |
| 62 local render = require "util.interpolation".new("%b{}", string.upper, { x = string.lower }); | |
| 63 assert.equal("", render("{foo?}", { })) | |
| 64 assert.equal("", render("{foo|x?}", { })) | |
| 65 end); | |
| 61 end); | 66 end); |