diff options
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/code.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/testes/code.lua b/testes/code.lua index b2702c61..b5091458 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
| @@ -409,5 +409,22 @@ checkequal(function () return 6 and true or nil end, | |||
| 409 | function () return k6 and kTrue or kNil end) | 409 | function () return k6 and kTrue or kNil end) |
| 410 | 410 | ||
| 411 | 411 | ||
| 412 | do -- string constants | ||
| 413 | local function f1 () | ||
| 414 | local <const> k = "00000000000000000000000000000000000000000000000000" | ||
| 415 | return function () | ||
| 416 | return function () return k end | ||
| 417 | end | ||
| 418 | end | ||
| 419 | |||
| 420 | local f2 = f1() | ||
| 421 | local f3 = f2() | ||
| 422 | assert(f3() == string.rep("0", 50)) | ||
| 423 | checkK(f3, f3()) | ||
| 424 | -- string is not needed by other functions | ||
| 425 | assert(T.listk(f1)[1] == nil) | ||
| 426 | assert(T.listk(f2)[1] == nil) | ||
| 427 | end | ||
| 428 | |||
| 412 | print 'OK' | 429 | print 'OK' |
| 413 | 430 | ||
