diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/db.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/testes/db.lua b/testes/db.lua index 941283f7..5377f6ec 100644 --- a/testes/db.lua +++ b/testes/db.lua | |||
@@ -884,7 +884,7 @@ end | |||
884 | 884 | ||
885 | 885 | ||
886 | print("testing debug functions on chunk without debug info") | 886 | print("testing debug functions on chunk without debug info") |
887 | prog = [[-- program to be loaded without debug information | 887 | prog = [[-- program to be loaded without debug information (strip) |
888 | local debug = require'debug' | 888 | local debug = require'debug' |
889 | local a = 12 -- a local variable | 889 | local a = 12 -- a local variable |
890 | 890 | ||
@@ -927,6 +927,23 @@ local f = assert(load(string.dump(load(prog), true))) | |||
927 | 927 | ||
928 | assert(f() == 13) | 928 | assert(f() == 13) |
929 | 929 | ||
930 | do -- bug in 5.4.0: line hooks in stripped code | ||
931 | local function foo () | ||
932 | local a = 1 | ||
933 | local b = 2 | ||
934 | return b | ||
935 | end | ||
936 | |||
937 | local s = load(string.dump(foo, true)) | ||
938 | local line = true | ||
939 | debug.sethook(function (e, l) | ||
940 | assert(e == "line") | ||
941 | line = l | ||
942 | end, "l") | ||
943 | assert(s() == 2); debug.sethook(nil) | ||
944 | assert(line == nil) -- hook called withoug debug info for 1st instruction | ||
945 | end | ||
946 | |||
930 | do -- tests for 'source' in binary dumps | 947 | do -- tests for 'source' in binary dumps |
931 | local prog = [[ | 948 | local prog = [[ |
932 | return function (x) | 949 | return function (x) |