diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/calls.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/testes/calls.lua b/testes/calls.lua index decf4176..ff72d8f6 100644 --- a/testes/calls.lua +++ b/testes/calls.lua | |||
@@ -317,6 +317,16 @@ f = load(string.dump(function () return 1 end), nil, "b", {}) | |||
317 | assert(type(f) == "function" and f() == 1) | 317 | assert(type(f) == "function" and f() == 1) |
318 | 318 | ||
319 | 319 | ||
320 | do -- another bug (in 5.4.0) | ||
321 | -- loading a binary long string interrupted by GC cycles | ||
322 | local f = string.dump(function () | ||
323 | return '01234567890123456789012345678901234567890123456789' | ||
324 | end) | ||
325 | f = load(read1(f)) | ||
326 | assert(f() == '01234567890123456789012345678901234567890123456789') | ||
327 | end | ||
328 | |||
329 | |||
320 | x = string.dump(load("x = 1; return x")) | 330 | x = string.dump(load("x = 1; return x")) |
321 | a = assert(load(read1(x), nil, "b")) | 331 | a = assert(load(read1(x), nil, "b")) |
322 | assert(a() == 1 and _G.x == 1) | 332 | assert(a() == 1 and _G.x == 1) |
@@ -358,8 +368,12 @@ x = [[ | |||
358 | end | 368 | end |
359 | end | 369 | end |
360 | ]] | 370 | ]] |
371 | a = assert(load(read1(x), "read", "t")) | ||
372 | assert(a()(2)(3)(10) == 15) | ||
361 | 373 | ||
362 | a = assert(load(read1(x))) | 374 | -- repeat the test loading a binary chunk |
375 | x = string.dump(a) | ||
376 | a = assert(load(read1(x), "read", "b")) | ||
363 | assert(a()(2)(3)(10) == 15) | 377 | assert(a()(2)(3)(10) == 15) |
364 | 378 | ||
365 | 379 | ||