diff options
Diffstat (limited to 'testes/db.lua')
-rw-r--r-- | testes/db.lua | 20 |
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 | ||
330 | local n, v = debug.getlocal(0, 1) | 330 | local n, v = debug.getlocal(0, 1) |
331 | assert(v == 0 and n == "(*temporary)") | 331 | assert(v == 0 and n == "(C temporary)") |
332 | local n, v = debug.getlocal(0, 2) | 332 | local n, v = debug.getlocal(0, 2) |
333 | assert(v == 2 and n == "(*temporary)") | 333 | assert(v == 2 and n == "(C temporary)") |
334 | assert(not debug.getlocal(0, 3)) | 334 | assert(not debug.getlocal(0, 3)) |
335 | assert(not debug.getlocal(0, 0)) | 335 | assert(not debug.getlocal(0, 0)) |
336 | 336 | ||
@@ -607,7 +607,7 @@ co = load[[ | |||
607 | local a = 0 | 607 | local 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 |
609 | debug.sethook(function (e, l) | 609 | debug.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 |
613 | end, "l") | 613 | end, "l") |
@@ -875,15 +875,15 @@ local debug = require'debug' | |||
875 | local a = 12 -- a local variable | 875 | local a = 12 -- a local variable |
876 | 876 | ||
877 | local n, v = debug.getlocal(1, 1) | 877 | local n, v = debug.getlocal(1, 1) |
878 | assert(n == "(*temporary)" and v == debug) -- unkown name but known value | 878 | assert(n == "(temporary)" and v == debug) -- unkown name but known value |
879 | n, v = debug.getlocal(1, 2) | 879 | n, v = debug.getlocal(1, 2) |
880 | assert(n == "(*temporary)" and v == 12) -- unkown name but known value | 880 | assert(n == "(temporary)" and v == 12) -- unkown name but known value |
881 | 881 | ||
882 | -- a function with an upvalue | 882 | -- a function with an upvalue |
883 | local f = function () local x; return a end | 883 | local f = function () local x; return a end |
884 | n, v = debug.getupvalue(f, 1) | 884 | n, v = debug.getupvalue(f, 1) |
885 | assert(n == "(*no name)" and v == 12) | 885 | assert(n == "(no name)" and v == 12) |
886 | assert(debug.setupvalue(f, 1, 13) == "(*no name)") | 886 | assert(debug.setupvalue(f, 1, 13) == "(no name)") |
887 | assert(a == 13) | 887 | assert(a == 13) |
888 | 888 | ||
889 | local t = debug.getinfo(f) | 889 | local t = debug.getinfo(f) |