diff options
Diffstat (limited to 'tests/lua.js')
-rw-r--r-- | tests/lua.js | 101 |
1 files changed, 52 insertions, 49 deletions
diff --git a/tests/lua.js b/tests/lua.js index 3056abd..d55b412 100644 --- a/tests/lua.js +++ b/tests/lua.js @@ -7,84 +7,87 @@ const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); const linit = require('../src/linit.js'); +// TODO: remove -test('locals.lua', function (t) { - let luaCode = ` - _soft = true - require = function(lib) return _G[lib] end -- NYI - return dofile("tests/lua-tests/locals.lua") - `, L; - - t.plan(2); +if (false) { + test('locals.lua', function (t) { + let luaCode = ` + _soft = true + require = function(lib) return _G[lib] end -- NYI + return dofile("tests/lua-tests/locals.lua") + `, L; + + t.plan(2); - t.doesNotThrow(function () { + t.doesNotThrow(function () { - L = lauxlib.luaL_newstate(); + L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + linit.luaL_openlibs(L); - lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); - }, "Lua program loaded without error"); + }, "Lua program loaded without error"); - t.doesNotThrow(function () { + t.doesNotThrow(function () { - lapi.lua_call(L, 0, -1); + lapi.lua_call(L, 0, -1); - }, "Lua program ran without error"); + }, "Lua program ran without error"); -}); + }); -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); + 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 () { + t.doesNotThrow(function () { - L = lauxlib.luaL_newstate(); + L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + linit.luaL_openlibs(L); - lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); - }, "Lua program loaded without error"); + }, "Lua program loaded without error"); - t.doesNotThrow(function () { + t.doesNotThrow(function () { - lapi.lua_call(L, 0, -1); + lapi.lua_call(L, 0, -1); - }, "Lua program ran without error"); + }, "Lua program ran without error"); -}); + }); -test('strings.lua', function (t) { - let luaCode = ` - return dofile("tests/lua-tests/strings.lua") - `, L; - - t.plan(2); + test('strings.lua', function (t) { + let luaCode = ` + return dofile("tests/lua-tests/strings.lua") + `, L; + + t.plan(2); - t.doesNotThrow(function () { + t.doesNotThrow(function () { - L = lauxlib.luaL_newstate(); + L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + linit.luaL_openlibs(L); - lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); - }, "Lua program loaded without error"); + }, "Lua program loaded without error"); - t.doesNotThrow(function () { + t.doesNotThrow(function () { - lapi.lua_call(L, 0, -1); + lapi.lua_call(L, 0, -1); - }, "Lua program ran without error"); + }, "Lua program ran without error"); -}); + }); +} |