aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-03-24 17:10:22 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-03-24 17:10:22 +0100
commit6f42ac9cce2ded1f62cf967f42c85b1171678fa1 (patch)
tree3642de0cfb5d95bdd2f4223354e35972de6720f8 /tests
parent8871373cea55df0374ed0d4da9cd21f2fb08fe09 (diff)
downloadfengari-6f42ac9cce2ded1f62cf967f42c85b1171678fa1.tar.gz
fengari-6f42ac9cce2ded1f62cf967f42c85b1171678fa1.tar.bz2
fengari-6f42ac9cce2ded1f62cf967f42c85b1171678fa1.zip
Added missing sprintf
Diffstat (limited to 'tests')
-rw-r--r--tests/single.lua9
1 files changed, 9 insertions, 0 deletions
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 ')