aboutsummaryrefslogtreecommitdiff
path: root/testes/db.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/db.lua')
-rw-r--r--testes/db.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/testes/db.lua b/testes/db.lua
index 5b243c39..976962b0 100644
--- a/testes/db.lua
+++ b/testes/db.lua
@@ -214,14 +214,14 @@ local function foo (a, ...)
214 local t = table.pack(...) 214 local t = table.pack(...)
215 for i = 1, t.n do 215 for i = 1, t.n do
216 local n, v = debug.getlocal(1, -i) 216 local n, v = debug.getlocal(1, -i)
217 assert(n == "(*vararg)" and v == t[i]) 217 assert(n == "(vararg)" and v == t[i])
218 end 218 end
219 assert(not debug.getlocal(1, -(t.n + 1))) 219 assert(not debug.getlocal(1, -(t.n + 1)))
220 assert(not debug.setlocal(1, -(t.n + 1), 30)) 220 assert(not debug.setlocal(1, -(t.n + 1), 30))
221 if t.n > 0 then 221 if t.n > 0 then
222 (function (x) 222 (function (x)
223 assert(debug.setlocal(2, -1, x) == "(*vararg)") 223 assert(debug.setlocal(2, -1, x) == "(vararg)")
224 assert(debug.setlocal(2, -t.n, x) == "(*vararg)") 224 assert(debug.setlocal(2, -t.n, x) == "(vararg)")
225 end)(430) 225 end)(430)
226 assert(... == 430) 226 assert(... == 430)
227 end 227 end
@@ -328,9 +328,9 @@ assert(a[f] and a[g] and a[assert] and a[debug.getlocal] and not a[print])
328-- tests for manipulating non-registered locals (C and Lua temporaries) 328-- tests for manipulating non-registered locals (C and Lua temporaries)
329 329
330local n, v = debug.getlocal(0, 1) 330local n, v = debug.getlocal(0, 1)
331assert(v == 0 and n == "(*temporary)") 331assert(v == 0 and n == "(C temporary)")
332local n, v = debug.getlocal(0, 2) 332local n, v = debug.getlocal(0, 2)
333assert(v == 2 and n == "(*temporary)") 333assert(v == 2 and n == "(C temporary)")
334assert(not debug.getlocal(0, 3)) 334assert(not debug.getlocal(0, 3))
335assert(not debug.getlocal(0, 0)) 335assert(not debug.getlocal(0, 0))
336 336
@@ -607,7 +607,7 @@ co = load[[
607local a = 0 607local a = 0
608-- 'A' should be visible to debugger only after its complete definition 608-- 'A' should be visible to debugger only after its complete definition
609debug.sethook(function (e, l) 609debug.sethook(function (e, l)
610 if l == 3 then a = a + 1; assert(debug.getlocal(2, 1) == "(*temporary)") 610 if l == 3 then a = a + 1; assert(debug.getlocal(2, 1) == "(temporary)")
611 elseif l == 4 then a = a + 1; assert(debug.getlocal(2, 1) == "A") 611 elseif l == 4 then a = a + 1; assert(debug.getlocal(2, 1) == "A")
612 end 612 end
613end, "l") 613end, "l")
@@ -875,15 +875,15 @@ local debug = require'debug'
875local a = 12 -- a local variable 875local a = 12 -- a local variable
876 876
877local n, v = debug.getlocal(1, 1) 877local n, v = debug.getlocal(1, 1)
878assert(n == "(*temporary)" and v == debug) -- unkown name but known value 878assert(n == "(temporary)" and v == debug) -- unkown name but known value
879n, v = debug.getlocal(1, 2) 879n, v = debug.getlocal(1, 2)
880assert(n == "(*temporary)" and v == 12) -- unkown name but known value 880assert(n == "(temporary)" and v == 12) -- unkown name but known value
881 881
882-- a function with an upvalue 882-- a function with an upvalue
883local f = function () local x; return a end 883local f = function () local x; return a end
884n, v = debug.getupvalue(f, 1) 884n, v = debug.getupvalue(f, 1)
885assert(n == "(*no name)" and v == 12) 885assert(n == "(no name)" and v == 12)
886assert(debug.setupvalue(f, 1, 13) == "(*no name)") 886assert(debug.setupvalue(f, 1, 13) == "(no name)")
887assert(a == 13) 887assert(a == 13)
888 888
889local t = debug.getinfo(f) 889local t = debug.getinfo(f)