Software /
code /
prosody
Comparison
spec/util_format_spec.lua @ 11120:b2331f3dfeea
Merge 0.11->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 30 Sep 2020 09:50:33 +0100 |
parent | 10035:386f085820e6 |
child | 11638:5f4a657136bc |
comparison
equal
deleted
inserted
replaced
11119:68df52bf08d5 | 11120:b2331f3dfeea |
---|---|
3 describe("util.format", function() | 3 describe("util.format", function() |
4 describe("#format()", function() | 4 describe("#format()", function() |
5 it("should work", function() | 5 it("should work", function() |
6 assert.equal("hello", format("%s", "hello")); | 6 assert.equal("hello", format("%s", "hello")); |
7 assert.equal("<nil>", format("%s")); | 7 assert.equal("<nil>", format("%s")); |
8 assert.equal("<nil>", format("%d")); | |
9 assert.equal("<nil>", format("%q")); | |
8 assert.equal(" [<nil>]", format("", nil)); | 10 assert.equal(" [<nil>]", format("", nil)); |
9 assert.equal("true", format("%s", true)); | 11 assert.equal("true", format("%s", true)); |
10 assert.equal("[true]", format("%d", true)); | 12 assert.equal("[true]", format("%d", true)); |
11 assert.equal("% [true]", format("%%", true)); | 13 assert.equal("% [true]", format("%%", true)); |
14 assert.equal("{ }", format("%q", { })); | |
15 assert.equal("[1.5]", format("%d", 1.5)); | |
16 assert.equal("[7.3786976294838e+19]", format("%d", 73786976294838206464)); | |
12 end); | 17 end); |
13 end); | 18 end); |
14 end); | 19 end); |