summaryrefslogtreecommitdiff
path: root/src/tests/elua
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 /src/tests/elua
parent9e28b90010aff31e9dbbd6fb539048893ebfbb2c (diff)
elua lib: test elua_util_file_run
Diffstat (limited to 'src/tests/elua')
-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)
13{ 13{
14 Elua_State *st; 14 Elua_State *st;
15 lua_State *lst; 15 lua_State *lst;
16 char buf[] = "tmpXXXXXX";
17 FILE *f;
18 int fd;
16 19
17 fail_if(!elua_init()); 20 fail_if(!elua_init());
18 21
@@ -75,6 +78,17 @@ START_TEST(elua_api)
75 fail_if(lua_type(lst, -1) != LUA_TSTRING); 78 fail_if(lua_type(lst, -1) != LUA_TSTRING);
76 lua_pop(lst, 1); 79 lua_pop(lst, 1);
77 80
81 fd = mkstemp(buf);
82 fail_if(fd < 0);
83 f = fdopen(fd, "w");
84 fail_if(!f);
85 fprintf(f, "return 5\n");
86 fclose(f);
87 fail_if(elua_util_file_run(st, buf));
88 fail_if(lua_tointeger(lst, -1) != 5);
89 lua_pop(lst, 1);
90 fail_if(remove(buf));
91
78 /* halfassed testing here, but not possible otherwise */ 92 /* halfassed testing here, but not possible otherwise */
79 fail_if(elua_util_error_report(st, "foo", 0)); 93 fail_if(elua_util_error_report(st, "foo", 0));
80 lua_pushliteral(lst, "msg"); 94 lua_pushliteral(lst, "msg");