# HG changeset patch # User Kim Alvefur # Date 1510289199 -3600 # Node ID d967d6f2ad00705e5fbe5f19fb676cd1357131f6 # Parent e5d00bf4a4d51755502407ed930e34237106cf6b util.format: Move tests to spec/ diff -r e5d00bf4a4d5 -r d967d6f2ad00 spec/util_format_spec.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spec/util_format_spec.lua Fri Nov 10 05:46:39 2017 +0100 @@ -0,0 +1,13 @@ +local format = require "util.format".format; + +describe("util.format", function() + describe("#format()", function() + it("should work", function() + assert.equal(format("%s", "hello"), "hello"); + assert.equal(format("%s"), ""); + assert.equal(format("%s", true), "true"); + assert.equal(format("%d", true), "[true]"); + assert.equal(format("%%", true), "% [true]"); + end); + end); +end); diff -r e5d00bf4a4d5 -r d967d6f2ad00 util/format.lua --- a/util/format.lua Fri Nov 10 05:42:32 2017 +0100 +++ b/util/format.lua Fri Nov 10 05:46:39 2017 +0100 @@ -4,7 +4,6 @@ local tostring = tostring; local select = select; -local assert = assert; local unpack = unpack; local type = type; @@ -60,15 +59,6 @@ return formatstring:format(unpack(args)); end -local function test() - assert(format("%s", "hello") == "hello"); - assert(format("%s") == ""); - assert(format("%s", true) == "true"); - assert(format("%d", true) == "[true]"); - assert(format("%%", true) == "% [true]"); -end - return { format = format; - test = test; };