aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
Diffstat (limited to 'testes')
-rw-r--r--testes/calls.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/testes/calls.lua b/testes/calls.lua
index 0dacb85a..cd4510a2 100644
--- a/testes/calls.lua
+++ b/testes/calls.lua
@@ -372,6 +372,32 @@ do -- another bug (in 5.4.0)
372end 372end
373 373
374 374
375if T then
376 -- check stack level when calling reader function
377 local function get (str)
378 local pos = 0
379 local level = nil
380 return function ()
381 pos = pos + 1
382 local c = string.sub(str, pos, pos)
383 local newlevel = T.stacklevel()
384 if not level then
385 level = newlevel
386 else
387 assert(level == newlevel)
388 end
389 return #c > 0 and c or nil
390 end
391 end
392
393 local str = "local function foo () end; return 121"
394 assert(assert(load(get(str)))() == 121)
395
396 str = string.dump(load(str))
397 assert(assert(load(get(str)))() == 121)
398end
399
400
375x = string.dump(load("x = 1; return x")) 401x = string.dump(load("x = 1; return x"))
376a = assert(load(read1(x), nil, "b")) 402a = assert(load(read1(x), nil, "b"))
377assert(a() == 1 and _G.x == 1) 403assert(a() == 1 and _G.x == 1)