in test mode, debug library is not predefined (to allow testing

'preloadedlibs')
This commit is contained in:
Roberto Ierusalimschy 2014-12-06 18:42:58 -02:00
parent 32a1f54b9a
commit 460968353f
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: linit.c,v 1.34 2014/05/15 19:28:34 roberto Exp roberto $ ** $Id: linit.c,v 1.35 2014/11/02 19:19:04 roberto Exp roberto $
** Initialization of libraries for lua.c and other clients ** Initialization of libraries for lua.c and other clients
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -37,8 +37,10 @@ static const luaL_Reg loadedlibs[] = {
{LUA_OSLIBNAME, luaopen_os}, {LUA_OSLIBNAME, luaopen_os},
{LUA_STRLIBNAME, luaopen_string}, {LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math}, {LUA_MATHLIBNAME, luaopen_math},
{LUA_DBLIBNAME, luaopen_debug},
{LUA_UTF8LIBNAME, luaopen_utf8}, {LUA_UTF8LIBNAME, luaopen_utf8},
#if !defined(LUA_NODEBUGLIB)
{LUA_DBLIBNAME, luaopen_debug},
#endif
#if defined(LUA_COMPAT_BITLIB) #if defined(LUA_COMPAT_BITLIB)
{LUA_BITLIBNAME, luaopen_bit32}, {LUA_BITLIBNAME, luaopen_bit32},
#endif #endif
@ -50,6 +52,9 @@ static const luaL_Reg loadedlibs[] = {
** these libs are preloaded and must be required before used ** these libs are preloaded and must be required before used
*/ */
static const luaL_Reg preloadedlibs[] = { static const luaL_Reg preloadedlibs[] = {
#if defined(LUA_NODEBUGLIB)
{LUA_DBLIBNAME, luaopen_debug},
#endif
{NULL, NULL} {NULL, NULL}
}; };

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ltests.h,v 2.41 2014/11/24 14:56:56 roberto Exp roberto $ ** $Id: ltests.h,v 2.42 2014/11/29 19:45:37 roberto Exp roberto $
** Internal Header for Debugging of the Lua Implementation ** Internal Header for Debugging of the Lua Implementation
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -24,6 +24,9 @@
#undef LUA_COMPAT_MODULE #undef LUA_COMPAT_MODULE
/* test without preloding debug library */
#define LUA_NODEBUGLIB
#define LUA_DEBUG #define LUA_DEBUG