Software /
code /
prosody
Comparison
spec/util_format_spec.lua @ 9693:6ed0d6224d64
util.format: Serialize values for the %q format
Improves eg debug logs
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 12 Oct 2018 01:29:34 +0200 |
parent | 9656:3da6cc927ee6 |
child | 10034:4fca92d60040 |
comparison
equal
deleted
inserted
replaced
9692:affcbccc1dff | 9693:6ed0d6224d64 |
---|---|
9 assert.equal("<nil>", format("%q")); | 9 assert.equal("<nil>", format("%q")); |
10 assert.equal(" [<nil>]", format("", nil)); | 10 assert.equal(" [<nil>]", format("", nil)); |
11 assert.equal("true", format("%s", true)); | 11 assert.equal("true", format("%s", true)); |
12 assert.equal("[true]", format("%d", true)); | 12 assert.equal("[true]", format("%d", true)); |
13 assert.equal("% [true]", format("%%", true)); | 13 assert.equal("% [true]", format("%%", true)); |
14 assert.equal("{ }", format("%q", { })); | |
14 end); | 15 end); |
15 end); | 16 end); |
16 end); | 17 end); |