From e2d9007d484641a3c3dffc325999fe509de1422a Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Wed, 26 Apr 2017 08:25:57 +0200 Subject: Breaking down lua test suite into tape tests --- tests/lua.js | 101 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 52 insertions(+), 49 deletions(-) (limited to 'tests/lua.js') 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"); -}); + }); +} -- cgit v1.2.3-54-g00ecf