Lua test program is loaded successfully.

pull/13171/head
Joshua Haberman 5 years ago
parent 6ae4a2694c
commit b518b06d75
  1. 8
      tests/bindings/lua/main.c
  2. 2
      tests/bindings/lua/test_upb.lua

@ -5,13 +5,19 @@
#include "upb/bindings/lua/upb.h"
const char *init =
"package.preload['lupb'] = ... "
"package.path = './?.lua;./third_party/lunit/?.lua'";
int main() {
int ret = 0;
lua_State *L = luaL_newstate();
luaL_openlibs(L);
lua_pushcfunction(L, luaopen_lupb);
ret = luaL_loadstring(L, init);
lua_pushcfunction(L, luaopen_lupb);
if (luaL_dostring(L, "package.preload['lupb'] = ...[1]") ||
if (ret || lua_pcall(L, 1, LUA_MULTRET, 0) ||
luaL_dofile(L, "tests/bindings/lua/test_upb.lua")) {
fprintf(stderr, "error testing Lua: %s\n", lua_tostring(L, -1));
ret = 1;

@ -1,5 +1,5 @@
local upb = require "upb"
local upb = require "lupb"
local lunit = require "lunit"
if _VERSION >= 'Lua 5.2' then

Loading…
Cancel
Save