summaryrefslogtreecommitdiff
path: root/src/tests/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-04-16 16:20:55 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:21 +0100
commit145cd1a615b6060805a5ce2aa197b77b523c1e5b (patch)
tree0bd151596f95e2ee6b830565a1defdc137fef394 /src/tests/elua
parent4da4f7a534451fce42ab1cd75f2bbb7346bea538 (diff)
elua lib: test elua_util_script_run
Diffstat (limited to 'src/tests/elua')
-rw-r--r--src/tests/elua/elua_lib.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tests/elua/elua_lib.c b/src/tests/elua/elua_lib.c
index 6c8952c731..0d670e56d8 100644
--- a/src/tests/elua/elua_lib.c
+++ b/src/tests/elua/elua_lib.c
@@ -16,6 +16,12 @@ START_TEST(elua_api)
16 char buf[] = "tmpXXXXXX"; 16 char buf[] = "tmpXXXXXX";
17 FILE *f; 17 FILE *f;
18 int fd; 18 int fd;
19 char *cargv[2];
20 char arg1[] = "test";
21 char arg2[] = "lualian";
22 int quit = 0;
23 cargv[0] = arg1;
24 cargv[1] = arg2;
19 25
20 fail_if(!elua_init()); 26 fail_if(!elua_init());
21 27
@@ -95,6 +101,18 @@ START_TEST(elua_api)
95 fail_if(!elua_util_error_report(st, "foo", 5)); 101 fail_if(!elua_util_error_report(st, "foo", 5));
96 fail_if(lua_gettop(lst) > 0); 102 fail_if(lua_gettop(lst) > 0);
97 103
104 fail_if(elua_util_script_run(st, 2, cargv, 1, &quit));
105 fail_if(quit != 1);
106
107 f = fopen(buf, "w");
108 fail_if(!f);
109 fprintf(f, "return false");
110 fclose(f);
111 cargv[1] = buf;
112 fail_if(elua_util_script_run(st, 2, cargv, 1, &quit));
113 fail_if(quit != 0);
114 fail_if(remove(buf));
115
98 elua_state_free(st); 116 elua_state_free(st);
99 117
100 elua_shutdown(); 118 elua_shutdown();