From 88d996132e47e9e91a37c2ade71f8d757d2cdb67 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 3 Dec 2019 20:57:14 -0800 Subject: [PATCH] Added Lua main.c test driver program. --- tests/bindings/lua/main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/bindings/lua/main.c diff --git a/tests/bindings/lua/main.c b/tests/bindings/lua/main.c new file mode 100644 index 0000000000..8a30d06d3d --- /dev/null +++ b/tests/bindings/lua/main.c @@ -0,0 +1,22 @@ + +#include +#include +#include + +#include "upb/bindings/lua/upb.h" + +int main() { + int ret = 0; + lua_State *L = luaL_newstate(); + luaL_openlibs(L); + lua_pushcfunction(L, luaopen_lupb); + + if (luaL_dostring(L, "package.preload['lupb'] = ...[1]") || + luaL_dofile(L, "tests/bindings/lua/test_upb.lua")) { + fprintf(stderr, "error testing Lua: %s\n", lua_tostring(L, -1)); + ret = 1; + } + + lua_close(L); + return ret; +}