summaryrefslogtreecommitdiff
path: root/src/tests/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-04-16 15:23:33 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:21 +0100
commit3b17064c105d3f52d737e95a2e082e2bba09ea34 (patch)
tree716ddbcb0811840e39db2fd28e3088c604cb75a3 /src/tests/elua
parent259f9067c2fa562e6f7d92f5bbb4018a769c0a07 (diff)
elua lib: test some util APIs
Diffstat (limited to 'src/tests/elua')
-rw-r--r--src/tests/elua/elua_lib.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/tests/elua/elua_lib.c b/src/tests/elua/elua_lib.c
index 98fca1a321..5a87929467 100644
--- a/src/tests/elua/elua_lib.c
+++ b/src/tests/elua/elua_lib.c
@@ -9,11 +9,6 @@
9#include "Elua.h" 9#include "Elua.h"
10#include "elua_suite.h" 10#include "elua_suite.h"
11 11
12/* Untestable APIs:
13 *
14 * void elua_state_include_path_add(Elua_State *, const char *);
15 */
16
17START_TEST(elua_api) 12START_TEST(elua_api)
18{ 13{
19 Elua_State *st; 14 Elua_State *st;
@@ -39,6 +34,9 @@ START_TEST(elua_api)
39 fail_if(strcmp(elua_state_mod_dir_get(st), ELUA_MODULES_DIR)); 34 fail_if(strcmp(elua_state_mod_dir_get(st), ELUA_MODULES_DIR));
40 fail_if(strcmp(elua_state_apps_dir_get(st), ELUA_APPS_DIR)); 35 fail_if(strcmp(elua_state_apps_dir_get(st), ELUA_APPS_DIR));
41 36
37 /* needed for later setup, but untestable alone */
38 elua_state_include_path_add(st, ELUA_BINDINGS_DIR);
39
42 lst = elua_state_lua_state_get(st); 40 lst = elua_state_lua_state_get(st);
43 fail_if(!lst); 41 fail_if(!lst);
44 42
@@ -58,6 +56,10 @@ START_TEST(elua_api)
58 fail_if(lua_type(lst, -1) != LUA_TFUNCTION); 56 fail_if(lua_type(lst, -1) != LUA_TFUNCTION);
59 lua_pop(lst, 1); 57 lua_pop(lst, 1);
60 58
59 fail_if(elua_util_require(st, "util"));
60 fail_if(elua_util_string_run(st, "return 1337", "foo"));
61 fail_if(!elua_util_string_run(st, "foo bar", "foo")); /* invalid code */
62
61 elua_state_free(st); 63 elua_state_free(st);
62 64
63 elua_shutdown(); 65 elua_shutdown();