Comparison

spec/util_format_spec.lua @ 9656:3da6cc927ee6

util.format: Tweak how nil values are handled Because [<nil>] seems exsessive
author Kim Alvefur <zash@zash.se>
date Wed, 28 Nov 2018 20:36:53 +0100
parent 8620:84b73949fc30
child 9693:6ed0d6224d64
comparison
equal deleted inserted replaced
9654:ede4e15a0fed 9656:3da6cc927ee6
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));
12 end); 14 end);