Software /
code /
prosody
Annotate
spec/util_interpolation_spec.lua @ 10303:c434bff22b14
mod_csi_simple: Always remove session filters when disabling CSI
Only guard the actual pausing of outgoing data on the method existing.
This prevents the filters from lingering in case something happened to
the connection. Removing already removed filters should be a safe noop.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 05 Oct 2019 16:55:58 +0200 |
parent | 9737:3d6f5b20cca6 |
child | 10350:75eab21b7968 |
rev | line source |
---|---|
9737
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local template = [[ |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 {greet!}, {name?world}! |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 ]]; |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 local expect1 = [[ |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 Hello, WORLD! |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 ]]; |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 local expect2 = [[ |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 Hello, world! |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 ]]; |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 describe("util.interpolation", function () |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 it("renders", function () |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 local render = require "util.interpolation".new("%b{}", string.upper); |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 assert.equal(expect1, render(template, { greet = "Hello", name = "world" })); |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 assert.equal(expect2, render(template, { greet = "Hello" })); |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 end); |
3d6f5b20cca6
spec: Stub tests for util.interpolation
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 end); |