Skip to content

Commit db24317

Browse files
author
Sebastien Bourdeauducq
committedJun 3, 2012
Lua I/O test
1 parent 07ab4d2 commit db24317

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed
 

‎main.c

+14-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,20 @@
1111
#include <lauxlib.h>
1212
#include <lualib.h>
1313

14+
//#define TEST_BASIC
15+
//#define TEST_DIR
16+
#define TEST_FILE
17+
1418
static void test_lua(void)
1519
{
1620
lua_State *L;
1721

18-
// /patchpool/nil - Cid and Lucy.fnp
19-
2022
L = luaL_newstate();
2123
luaL_openlibs(L);
24+
#ifdef TEST_BASIC
2225
luaL_dostring(L, "for i=10,1,-1 do print(i) end\n");
26+
#endif
27+
#ifdef TEST_DIR
2328
luaL_dostring(L, "function attrdir (path)\n"
2429
" for file in lfs.dir(path) do\n"
2530
" if file ~= \".\" and file ~= \"..\" then\n"
@@ -39,6 +44,13 @@ static void test_lua(void)
3944
"end\n"
4045
"\n"
4146
"attrdir (\"/\")\n");
47+
#endif
48+
#ifdef TEST_FILE
49+
luaL_dostring(L, "f = assert(io.open(\"/patchpool/nil - Cid and Lucy.fnp\"))\n"
50+
"t = f:read(\"*all\")\n"
51+
"print(t)\n"
52+
"f:close()\n");
53+
#endif
4254
lua_close(L);
4355
}
4456

0 commit comments

Comments
 (0)
Please sign in to comment.