diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/all.lua | 2 | ||||
-rw-r--r-- | testes/api.lua | 4 | ||||
-rw-r--r-- | testes/coroutine.lua | 19 | ||||
-rw-r--r-- | testes/errors.lua | 4 | ||||
-rw-r--r-- | testes/events.lua | 13 | ||||
-rw-r--r-- | testes/gc.lua | 10 |
6 files changed, 51 insertions, 1 deletions
diff --git a/testes/all.lua b/testes/all.lua index 5df0ff9b..413d4da2 100644 --- a/testes/all.lua +++ b/testes/all.lua | |||
@@ -287,7 +287,7 @@ print("final OK !!!") | |||
287 | 287 | ||
288 | --[[ | 288 | --[[ |
289 | ***************************************************************************** | 289 | ***************************************************************************** |
290 | * Copyright (C) 1994-2016 Lua.org, PUC-Rio. | 290 | * Copyright (C) 1994-2025 Lua.org, PUC-Rio. |
291 | * | 291 | * |
292 | * Permission is hereby granted, free of charge, to any person obtaining | 292 | * Permission is hereby granted, free of charge, to any person obtaining |
293 | * a copy of this software and associated documentation files (the | 293 | * a copy of this software and associated documentation files (the |
diff --git a/testes/api.lua b/testes/api.lua index 752ff18f..eab3059b 100644 --- a/testes/api.lua +++ b/testes/api.lua | |||
@@ -399,6 +399,10 @@ do | |||
399 | -- trivial error | 399 | -- trivial error |
400 | assert(T.checkpanic("pushstring hi; error") == "hi") | 400 | assert(T.checkpanic("pushstring hi; error") == "hi") |
401 | 401 | ||
402 | -- thread status inside panic (bug in 5.4.4) | ||
403 | assert(T.checkpanic("pushstring hi; error", "threadstatus; return 2") == | ||
404 | "ERRRUN") | ||
405 | |||
402 | -- using the stack inside panic | 406 | -- using the stack inside panic |
403 | assert(T.checkpanic("pushstring hi; error;", | 407 | assert(T.checkpanic("pushstring hi; error;", |
404 | [[checkstack 5 XX | 408 | [[checkstack 5 XX |
diff --git a/testes/coroutine.lua b/testes/coroutine.lua index e566c86e..03e04451 100644 --- a/testes/coroutine.lua +++ b/testes/coroutine.lua | |||
@@ -493,6 +493,25 @@ assert(not pcall(a, a)) | |||
493 | a = nil | 493 | a = nil |
494 | 494 | ||
495 | 495 | ||
496 | do | ||
497 | -- bug in 5.4: thread can use message handler higher in the stack | ||
498 | -- than the variable being closed | ||
499 | local c = coroutine.create(function() | ||
500 | local clo <close> = setmetatable({}, {__close=function() | ||
501 | local x = 134 -- will overwrite message handler | ||
502 | error(x) | ||
503 | end}) | ||
504 | -- yields coroutine but leaves a new message handler for it, | ||
505 | -- that would be used when closing the coroutine (except that it | ||
506 | -- will be overwritten) | ||
507 | xpcall(coroutine.yield, function() return "XXX" end) | ||
508 | end) | ||
509 | |||
510 | assert(coroutine.resume(c)) -- start coroutine | ||
511 | local st, msg = coroutine.close(c) | ||
512 | assert(not st and msg == 134) | ||
513 | end | ||
514 | |||
496 | -- access to locals of erroneous coroutines | 515 | -- access to locals of erroneous coroutines |
497 | local x = coroutine.create (function () | 516 | local x = coroutine.create (function () |
498 | local a = 10 | 517 | local a = 10 |
diff --git a/testes/errors.lua b/testes/errors.lua index 80d91a92..15401b4f 100644 --- a/testes/errors.lua +++ b/testes/errors.lua | |||
@@ -137,6 +137,10 @@ checkmessage("aaa=(1)..{}", "a table value") | |||
137 | -- bug in 5.4.6 | 137 | -- bug in 5.4.6 |
138 | checkmessage("a = {_ENV = {}}; print(a._ENV.x + 1)", "field 'x'") | 138 | checkmessage("a = {_ENV = {}}; print(a._ENV.x + 1)", "field 'x'") |
139 | 139 | ||
140 | -- a similar bug in 5.4.7, since 5.4.0 | ||
141 | checkmessage("print(('_ENV').x + 1)", "field 'x'") | ||
142 | |||
143 | |||
140 | _G.aaa, _G.bbbb = nil | 144 | _G.aaa, _G.bbbb = nil |
141 | 145 | ||
142 | -- calls | 146 | -- calls |
diff --git a/testes/events.lua b/testes/events.lua index 8d8563b9..def13dc8 100644 --- a/testes/events.lua +++ b/testes/events.lua | |||
@@ -370,6 +370,19 @@ x = 0 .."a".."b"..c..d.."e".."f".."g" | |||
370 | assert(x.val == "0abcdefg") | 370 | assert(x.val == "0abcdefg") |
371 | 371 | ||
372 | 372 | ||
373 | do | ||
374 | -- bug since 5.4.1 | ||
375 | local mt = setmetatable({__newindex={}}, {__mode='v'}) | ||
376 | local t = setmetatable({}, mt) | ||
377 | |||
378 | if T then T.allocfailnext() end | ||
379 | |||
380 | -- seg. fault | ||
381 | for i=1, 10 do t[i] = 1 end | ||
382 | end | ||
383 | |||
384 | |||
385 | |||
373 | -- concat metamethod x numbers (bug in 5.1.1) | 386 | -- concat metamethod x numbers (bug in 5.1.1) |
374 | c = {} | 387 | c = {} |
375 | local x | 388 | local x |
diff --git a/testes/gc.lua b/testes/gc.lua index 03093e34..f017f330 100644 --- a/testes/gc.lua +++ b/testes/gc.lua | |||
@@ -301,6 +301,16 @@ collectgarbage() | |||
301 | assert(next(a) == string.rep('$', 11)) | 301 | assert(next(a) == string.rep('$', 11)) |
302 | 302 | ||
303 | 303 | ||
304 | if T then -- bug since 5.3: all-weak tables are not being revisited | ||
305 | T.gcstate("propagate") | ||
306 | local t = setmetatable({}, {__mode = "kv"}) | ||
307 | T.gcstate("atomic") -- 't' was visited | ||
308 | setmetatable(t, {__mode = "kv"}) | ||
309 | T.gcstate("pause") -- its new metatable is not being visited | ||
310 | assert(getmetatable(t).__mode == "kv") | ||
311 | end | ||
312 | |||
313 | |||
304 | -- 'bug' in 5.1 | 314 | -- 'bug' in 5.1 |
305 | a = {} | 315 | a = {} |
306 | local t = {x = 10} | 316 | local t = {x = 10} |