aboutsummaryrefslogtreecommitdiff
path: root/tests/lua.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lua.js')
-rw-r--r--tests/lua.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/lua.js b/tests/lua.js
index 43e82bc..30a9c98 100644
--- a/tests/lua.js
+++ b/tests/lua.js
@@ -7,6 +7,35 @@ const lauxlib = require("../src/lauxlib.js");
const lua = require('../src/lua.js');
const linit = require('../src/linit.js');
+
+test('constructs.lua', function (t) {
+ let luaCode = `
+ _soft = true
+ require = function(lib) return _G[lib] end -- NYI
+ return dofile("tests/lua-tests/constructs.lua")
+ `, L;
+
+ t.plan(2);
+
+ t.doesNotThrow(function () {
+
+ L = lauxlib.luaL_newstate();
+
+ linit.luaL_openlibs(L);
+
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
+
+ }, "Lua program loaded without error");
+
+ t.doesNotThrow(function () {
+
+ lapi.lua_call(L, 0, -1);
+
+ }, "Lua program ran without error");
+
+});
+
+
test('strings.lua', function (t) {
let luaCode = `
return dofile("tests/lua-tests/strings.lua")