diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-18 14:42:52 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-18 14:42:52 -0300 |
commit | eec0905173702423569222bfabae1eb0500b4626 (patch) | |
tree | 03f6d4f64b94685de10c6df72e810b63cf994bc6 /ldblib.c | |
parent | a44f37513becb25d0595df1e714851870b50b6dd (diff) | |
download | lua-eec0905173702423569222bfabae1eb0500b4626.tar.gz lua-eec0905173702423569222bfabae1eb0500b4626.tar.bz2 lua-eec0905173702423569222bfabae1eb0500b4626.zip |
better tests (assertions) for debug hooks
Diffstat (limited to 'ldblib.c')
-rw-r--r-- | ldblib.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.58 2002/06/18 15:17:58 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.59 2002/06/18 17:10:43 roberto Exp roberto $ |
3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -126,12 +126,17 @@ static void hookf (lua_State *L, void *key) { | |||
126 | 126 | ||
127 | static void callf (lua_State *L, lua_Debug *ar) { | 127 | static void callf (lua_State *L, lua_Debug *ar) { |
128 | lua_pushstring(L, ar->event); | 128 | lua_pushstring(L, ar->event); |
129 | lua_assert(lua_getinfo(L, "lS", ar) && ar->currentline == -1); | ||
129 | hookf(L, (void *)&KEY_CALLHOOK); | 130 | hookf(L, (void *)&KEY_CALLHOOK); |
130 | } | 131 | } |
131 | 132 | ||
132 | 133 | ||
133 | static void linef (lua_State *L, lua_Debug *ar) { | 134 | static void linef (lua_State *L, lua_Debug *ar) { |
134 | lua_pushnumber(L, ar->currentline); | 135 | lua_pushnumber(L, ar->currentline); |
136 | lua_assert((ar->currentline = ar->linedefined = -1, | ||
137 | lua_getinfo(L, "lS", ar) && | ||
138 | ar->currentline == lua_tonumber(L, -1) && | ||
139 | ar->linedefined >= 0)); | ||
135 | hookf(L, (void *)&KEY_LINEHOOK); | 140 | hookf(L, (void *)&KEY_LINEHOOK); |
136 | } | 141 | } |
137 | 142 | ||