diff options
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/errors.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testes/errors.lua b/testes/errors.lua index 825f37c2..a7dc479a 100644 --- a/testes/errors.lua +++ b/testes/errors.lua | |||
| @@ -228,6 +228,22 @@ do -- named objects (field '__name') | |||
| 228 | checkmessage("return {} < XX", "table with My Type") | 228 | checkmessage("return {} < XX", "table with My Type") |
| 229 | checkmessage("return XX < io.stdin", "My Type with FILE*") | 229 | checkmessage("return XX < io.stdin", "My Type with FILE*") |
| 230 | _G.XX = nil | 230 | _G.XX = nil |
| 231 | |||
| 232 | if T then -- extra tests for 'luaL_tolstring' | ||
| 233 | -- bug in 5.4.3; 'luaL_tolstring' with negative indices | ||
| 234 | local x = setmetatable({}, {__name="TABLE"}) | ||
| 235 | assert(T.testC("Ltolstring -1; return 1", x) == tostring(x)) | ||
| 236 | |||
| 237 | local a, b = T.testC("pushint 10; Ltolstring -2; return 2", x) | ||
| 238 | assert(a == 10 and b == tostring(x)) | ||
| 239 | |||
| 240 | setmetatable(x, {__tostring=function (o) | ||
| 241 | assert(o == x) | ||
| 242 | return "ABC" | ||
| 243 | end}) | ||
| 244 | a, b, c = T.testC("pushint 10; Ltolstring -2; return 3", x) | ||
| 245 | assert(a == x and b == 10 and c == "ABC") | ||
| 246 | end | ||
| 231 | end | 247 | end |
| 232 | 248 | ||
| 233 | -- global functions | 249 | -- global functions |
