aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPhilipp Janda <siffiejoe@gmx.net>2017-08-09 23:07:31 +0200
committerPhilipp Janda <siffiejoe@gmx.net>2017-08-09 23:07:31 +0200
commit574c0905c1ab394b20e4a763d0f85c042c3cd45b (patch)
treec1231489be8e65950cbfa605e03cfcac8a183eb9 /tests
parentb1abaff6353be16009b1bf4ff2f91174632f0819 (diff)
downloadlua-compat-5.3-574c0905c1ab394b20e4a763d0f85c042c3cd45b.tar.gz
lua-compat-5.3-574c0905c1ab394b20e4a763d0f85c042c3cd45b.tar.bz2
lua-compat-5.3-574c0905c1ab394b20e4a763d0f85c042c3cd45b.zip
Add tests for luaL_tolstring and string.pack.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test.lua b/tests/test.lua
index 8adad1a..be16af9 100755
--- a/tests/test.lua
+++ b/tests/test.lua
@@ -282,8 +282,9 @@ end
282 282
283 283
284if string.pack then 284if string.pack then
285 -- TODO 285 local format = "bBhHlLjJdc3z"
286 print("TODO: test string packing/unpacking") 286 local s = string.pack(format, -128, 255, -32768, 65535, -2147483648, 4294967295, -32768, 65536, 1.25, "abc", "defgh")
287 print("string.unpack", string.unpack(format, s))
287 ___'' 288 ___''
288else 289else
289 print("XXX: string packing not available") 290 print("XXX: string packing not available")
@@ -770,6 +771,9 @@ local t = setmetatable({}, {
770 __tostring = function(v) return nil end 771 __tostring = function(v) return nil end
771}) 772})
772print(pcall(mod.tolstring, t)) 773print(pcall(mod.tolstring, t))
774local ud, meta = mod.newproxy()
775meta.__name = "XXX"
776print(mod.tolstring(ud):gsub(":.*$", ": yyy"))
773 777
774___'' 778___''
775print(mod.buffer()) 779print(mod.buffer())