elua lib: test error reporting + lua stack state
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Thu, 16 Apr 2015 14:33:10 +0000 (15:33 +0100)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Wed, 6 May 2015 14:05:21 +0000 (15:05 +0100)
src/tests/elua/elua_lib.c

index 6d261c8..4bf7796 100644 (file)
@@ -60,7 +60,17 @@ START_TEST(elua_api)
     fail_if(elua_util_string_run(st, "return 1337", "foo"));
     fail_if(!elua_util_string_run(st, "foo bar", "foo")); /* invalid code */
     fail_if(!elua_util_app_load(st, "lualian"));
+    fail_if(lua_type(lst, -1) != LUA_TFUNCTION);
+    lua_pop(lst, 1);
     fail_if(elua_util_app_load(st, "non_existent_app"));
+    fail_if(lua_type(lst, -1) != LUA_TSTRING);
+    lua_pop(lst, 1);
+
+    /* halfassed testing here, but not possible otherwise */
+    fail_if(elua_util_error_report(st, "foo", 0));
+    lua_pushliteral(lst, "msg");
+    fail_if(!elua_util_error_report(st, "foo", 5));
+    fail_if(lua_gettop(lst) > 0);
 
     elua_state_free(st);