From 6f42ac9cce2ded1f62cf967f42c85b1171678fa1 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 24 Mar 2017 17:10:22 +0100 Subject: Added missing sprintf --- tests/single.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/single.lua b/tests/single.lua index e8d7210..c87ac7e 100644 --- a/tests/single.lua +++ b/tests/single.lua @@ -156,3 +156,12 @@ x = "\0\1\0023\5\0009" assert(load(string.format('return %q', x))() == x) assert(string.format("\0%c\0%c%x\0", string.byte("\xe4"), string.byte("b"), 140) == "\0\xe4\0b8c\0") +assert(string.format('') == "") +assert(string.format("%c",34)..string.format("%c",48)..string.format("%c",90)..string.format("%c",100) == + string.format("%c%c%c%c", 34, 48, 90, 100)) +assert(string.format("%s\0 is not \0%s", 'not be', 'be') == 'not be\0 is not \0be') +assert(string.format("%%%d %010d", 10, 23) == "%10 0000000023") +assert(tonumber(string.format("%f", 10.3)) == 10.3) +x = string.format('"%-50s"', 'a') +assert(#x == 52) +assert(string.sub(x, 1, 4) == '"a ') -- cgit v1.2.3-70-g09d2