Mercurial > prosody-hg
comparison spec/util_format_spec.lua @ 11200:bf8f2da84007
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 05 Nov 2020 22:31:25 +0100 |
| parents | 386f085820e6 |
| children | 5f4a657136bc |
comparison
equal
deleted
inserted
replaced
| 11199:6c7c50a4de32 | 11200:bf8f2da84007 |
|---|---|
| 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); |
