diff options
Diffstat (limited to 'testes/locals.lua')
| -rw-r--r-- | testes/locals.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testes/locals.lua b/testes/locals.lua index 90a8b845..24681dd9 100644 --- a/testes/locals.lua +++ b/testes/locals.lua | |||
| @@ -266,6 +266,27 @@ do -- errors in __close | |||
| 266 | end | 266 | end |
| 267 | 267 | ||
| 268 | 268 | ||
| 269 | do | ||
| 270 | |||
| 271 | -- errors due to non-closable values | ||
| 272 | local function foo () | ||
| 273 | local *toclose x = 34 | ||
| 274 | end | ||
| 275 | local stat, msg = pcall(foo) | ||
| 276 | assert(not stat and string.find(msg, "variable 'x'")) | ||
| 277 | |||
| 278 | |||
| 279 | -- with other errors, non-closable values are ignored | ||
| 280 | local function foo () | ||
| 281 | local *toclose x = 34 | ||
| 282 | local *toclose y = function () error(32) end | ||
| 283 | end | ||
| 284 | local stat, msg = pcall(foo) | ||
| 285 | assert(not stat and msg == 32) | ||
| 286 | |||
| 287 | end | ||
| 288 | |||
| 289 | |||
| 269 | if rawget(_G, "T") then | 290 | if rawget(_G, "T") then |
| 270 | 291 | ||
| 271 | -- memory error inside closing function | 292 | -- memory error inside closing function |
