diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2017-08-09 23:07:31 +0200 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2017-08-09 23:07:31 +0200 |
commit | 574c0905c1ab394b20e4a763d0f85c042c3cd45b (patch) | |
tree | c1231489be8e65950cbfa605e03cfcac8a183eb9 /tests | |
parent | b1abaff6353be16009b1bf4ff2f91174632f0819 (diff) | |
download | lua-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-x | tests/test.lua | 8 |
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 | ||
284 | if string.pack then | 284 | if 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 | ___'' |
288 | else | 289 | else |
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 | }) |
772 | print(pcall(mod.tolstring, t)) | 773 | print(pcall(mod.tolstring, t)) |
774 | local ud, meta = mod.newproxy() | ||
775 | meta.__name = "XXX" | ||
776 | print(mod.tolstring(ud):gsub(":.*$", ": yyy")) | ||
773 | 777 | ||
774 | ___'' | 778 | ___'' |
775 | print(mod.buffer()) | 779 | print(mod.buffer()) |