summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-04-16 16:06:48 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:21 +0100
commit4da4f7a534451fce42ab1cd75f2bbb7346bea538 (patch)
treea8289ad20aaa0065bde942032db927796b68f008
parent9e28b90010aff31e9dbbd6fb539048893ebfbb2c (diff)
downloadefl-4da4f7a534451fce42ab1cd75f2bbb7346bea538.tar.gz
elua lib: test elua_util_file_run
-rw-r--r--src/tests/elua/elua_lib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tests/elua/elua_lib.c b/src/tests/elua/elua_lib.c
index ffa99f52e6..6c8952c731 100644
--- a/src/tests/elua/elua_lib.c
+++ b/src/tests/elua/elua_lib.c
@@ -13,6 +13,9 @@ START_TEST(elua_api)
{
Elua_State *st;
lua_State *lst;
+ char buf[] = "tmpXXXXXX";
+ FILE *f;
+ int fd;
fail_if(!elua_init());
@@ -75,6 +78,17 @@ START_TEST(elua_api)
fail_if(lua_type(lst, -1) != LUA_TSTRING);
lua_pop(lst, 1);
+ fd = mkstemp(buf);
+ fail_if(fd < 0);
+ f = fdopen(fd, "w");
+ fail_if(!f);
+ fprintf(f, "return 5\n");
+ fclose(f);
+ fail_if(elua_util_file_run(st, buf));
+ fail_if(lua_tointeger(lst, -1) != 5);
+ lua_pop(lst, 1);
+ fail_if(remove(buf));
+
/* halfassed testing here, but not possible otherwise */
fail_if(elua_util_error_report(st, "foo", 0));
lua_pushliteral(lst, "msg");