diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-10-22 15:07:55 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-10-22 15:07:55 -0300 |
| commit | 4fb9110a6e85a49e80605a178c9f926c8e70390e (patch) | |
| tree | 7eba0abd74628e1b24b0350bab74380d238bf72c | |
| parent | 11886dc7b0f6fdc69d45fa019b23f9aa9094e91c (diff) | |
| download | lua-4fb9110a6e85a49e80605a178c9f926c8e70390e.tar.gz lua-4fb9110a6e85a49e80605a178c9f926c8e70390e.tar.bz2 lua-4fb9110a6e85a49e80605a178c9f926c8e70390e.zip | |
tests for compatibility functions lua_dostring/lua_dofile
| -rw-r--r-- | ltests.c | 14 |
1 files changed, 13 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.135 2002/09/05 19:57:08 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.136 2002/10/22 17:18:28 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 | */ |
| @@ -478,6 +478,17 @@ static int log2_aux (lua_State *L) { | |||
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | 480 | ||
| 481 | static int test_do (lua_State *L) { | ||
| 482 | const char *p = luaL_check_string(L, 1); | ||
| 483 | if (*p == '@') | ||
| 484 | lua_dofile(L, p+1); | ||
| 485 | else | ||
| 486 | lua_dostring(L, p); | ||
| 487 | return lua_gettop(L); | ||
| 488 | } | ||
| 489 | |||
| 490 | |||
| 491 | |||
| 481 | /* | 492 | /* |
| 482 | ** {====================================================== | 493 | ** {====================================================== |
| 483 | ** function to test the API with C. It interprets a kind of assembler | 494 | ** function to test the API with C. It interprets a kind of assembler |
| @@ -683,6 +694,7 @@ static const struct luaL_reg tests_funcs[] = { | |||
| 683 | {"stacklevel", stacklevel}, | 694 | {"stacklevel", stacklevel}, |
| 684 | {"querystr", string_query}, | 695 | {"querystr", string_query}, |
| 685 | {"querytab", table_query}, | 696 | {"querytab", table_query}, |
| 697 | {"doit", test_do}, | ||
| 686 | {"testC", testC}, | 698 | {"testC", testC}, |
| 687 | {"ref", tref}, | 699 | {"ref", tref}, |
| 688 | {"getref", getref}, | 700 | {"getref", getref}, |
