diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-06-13 11:15:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-06-13 11:15:59 -0300 |
commit | 860e285f31ad388aa6d6ad38ff7d203d49378965 (patch) | |
tree | 276d02a2fa9ee43e2ad4289a6da0f03f6dd41cb0 | |
parent | eb8ac6e2a0eb84f3849d5bd50fd3bd2adb903521 (diff) | |
download | lua-860e285f31ad388aa6d6ad38ff7d203d49378965.tar.gz lua-860e285f31ad388aa6d6ad38ff7d203d49378965.tar.bz2 lua-860e285f31ad388aa6d6ad38ff7d203d49378965.zip |
'luaL_gsub' moved into 'testC' (all auxlib should be tested through 'testC')
-rw-r--r-- | ltests.c | 30 |
1 files changed, 7 insertions, 23 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.48 2008/04/02 17:38:54 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.49 2008/06/12 14:20:49 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1017,6 +1017,12 @@ static int testC (lua_State *L) { | |||
1017 | int i = getindex; | 1017 | int i = getindex; |
1018 | lua_pushboolean(L1, luaL_testudata(L1, i, getname) != NULL); | 1018 | lua_pushboolean(L1, luaL_testudata(L1, i, getname) != NULL); |
1019 | } | 1019 | } |
1020 | else if EQ("gsub") { | ||
1021 | int a = getnum; int b = getnum; int c = getnum; | ||
1022 | luaL_gsub(L1, lua_tostring(L1, a), | ||
1023 | lua_tostring(L, b), | ||
1024 | lua_tostring(L, c)); | ||
1025 | } | ||
1020 | else if EQ("throw") { | 1026 | else if EQ("throw") { |
1021 | #if defined(__cplusplus) | 1027 | #if defined(__cplusplus) |
1022 | static struct X { int x; } x; | 1028 | static struct X { int x; } x; |
@@ -1079,27 +1085,6 @@ static int coresume (lua_State *L) { | |||
1079 | 1085 | ||
1080 | 1086 | ||
1081 | 1087 | ||
1082 | /* | ||
1083 | ** {====================================================== | ||
1084 | ** tests auxlib functions | ||
1085 | ** ======================================================= | ||
1086 | */ | ||
1087 | |||
1088 | static int auxgsub (lua_State *L) { | ||
1089 | const char *s1 = luaL_checkstring(L, 1); | ||
1090 | const char *s2 = luaL_checkstring(L, 2); | ||
1091 | const char *s3 = luaL_checkstring(L, 3); | ||
1092 | lua_settop(L, 3); | ||
1093 | luaL_gsub(L, s1, s2, s3); | ||
1094 | lua_assert(lua_gettop(L) == 4); | ||
1095 | return 1; | ||
1096 | } | ||
1097 | |||
1098 | |||
1099 | /* }====================================================== */ | ||
1100 | |||
1101 | |||
1102 | |||
1103 | static const struct luaL_Reg tests_funcs[] = { | 1088 | static const struct luaL_Reg tests_funcs[] = { |
1104 | {"checkmemory", lua_checkmemory}, | 1089 | {"checkmemory", lua_checkmemory}, |
1105 | {"closestate", closestate}, | 1090 | {"closestate", closestate}, |
@@ -1109,7 +1094,6 @@ static const struct luaL_Reg tests_funcs[] = { | |||
1109 | {"gccolor", get_gccolor}, | 1094 | {"gccolor", get_gccolor}, |
1110 | {"gcstate", gcstate}, | 1095 | {"gcstate", gcstate}, |
1111 | {"getref", getref}, | 1096 | {"getref", getref}, |
1112 | {"gsub", auxgsub}, | ||
1113 | {"hash", hash_query}, | 1097 | {"hash", hash_query}, |
1114 | {"int2fb", int2fb_aux}, | 1098 | {"int2fb", int2fb_aux}, |
1115 | {"limits", get_limits}, | 1099 | {"limits", get_limits}, |