From 6fdfa3b88c043b124eca4f91c4d1e7e3cc7046b2 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 26 Apr 2017 21:47:54 +1000 Subject: Export luaL_openlibs from lauxlib.js --- src/lauxlib.js | 2 ++ src/linit.js | 3 +-- tests/lapi.js | 1 - tests/lbaselib.js | 35 +++++++++++++------------- tests/lcorolib.js | 11 ++++----- tests/ldblib.js | 19 +++++++------- tests/ldebug.js | 15 ++++++----- tests/lexparse.js | 55 ++++++++++++++++++++--------------------- tests/lmathlib.js | 27 ++++++++++---------- tests/load.js | 13 +++++----- tests/loslib.js | 3 +-- tests/lstrlib.js | 43 ++++++++++++++++---------------- tests/ltablib.js | 17 ++++++------- tests/ltm.js | 35 +++++++++++++------------- tests/lua.js | 7 +++--- tests/lutf8lib.js | 11 ++++----- tests/manual-tests/debug-cli.js | 3 +-- tests/manual-tests/lua-cli.js | 3 +-- tests/test-suite/strings.js | 37 ++++++++++++++------------- 19 files changed, 162 insertions(+), 178 deletions(-) diff --git a/src/lauxlib.js b/src/lauxlib.js index 8bf9a37..7d48e11 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -4,6 +4,7 @@ const lapi = require('./lapi.js'); const lua = require('./lua.js'); const lobject = require('./lobject.js'); +const linit = require('./linit.js'); const LUA_LOADED_TABLE = "_LOADED"; @@ -725,6 +726,7 @@ module.exports.luaL_loadstring = luaL_loadstring; module.exports.luaL_newlib = luaL_newlib; module.exports.luaL_newmetatable = luaL_newmetatable; module.exports.luaL_newstate = luaL_newstate; +module.exports.luaL_openlibs = linit.luaL_openlibs; module.exports.luaL_opt = luaL_opt; module.exports.luaL_optinteger = luaL_optinteger; module.exports.luaL_optlstring = luaL_optlstring; diff --git a/src/linit.js b/src/linit.js index 925b55a..325dfa1 100644 --- a/src/linit.js +++ b/src/linit.js @@ -1,7 +1,6 @@ "use strict"; const lua = require('./lua.js'); -const lapi = require('./lapi.js'); const lauxlib = require('./lauxlib.js'); const lbaselib = require('./lbaselib.js'); const lcorolib = require('./lcorolib.js'); @@ -30,7 +29,7 @@ const luaL_openlibs = function(L) { /* "require" functions from 'loadedlibs' and set results to global table */ for (let lib in loadedlibs) { lauxlib.luaL_requiref(L, lua.to_luastring(lib), loadedlibs[lib], 1); - lapi.lua_pop(L, 1); /* remove lib */ + lua.lua_pop(L, 1); /* remove lib */ } }; diff --git a/tests/lapi.js b/tests/lapi.js index 2221ba6..8c7a81a 100644 --- a/tests/lapi.js +++ b/tests/lapi.js @@ -10,7 +10,6 @@ const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); test('luaL_newstate, lua_pushnil, luaL_typename', function (t) { let L; diff --git a/tests/lbaselib.js b/tests/lbaselib.js index bf571dd..42730e4 100644 --- a/tests/lbaselib.js +++ b/tests/lbaselib.js @@ -10,7 +10,6 @@ const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); test('print', function (t) { let luaCode = ` @@ -25,7 +24,7 @@ test('print', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-print"), lua.to_luastring("binary")); @@ -59,7 +58,7 @@ test('setmetatable, getmetatable', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-setmetatable-getmetatable"), lua.to_luastring("binary")); @@ -104,7 +103,7 @@ test('rawequal', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-rawequal"), lua.to_luastring("binary")); @@ -150,7 +149,7 @@ test('rawset, rawget', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-rawequal"), lua.to_luastring("binary")); @@ -197,7 +196,7 @@ test('type', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-type"), lua.to_luastring("binary")); @@ -250,7 +249,7 @@ test('error', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-error"), lua.to_luastring("binary")); @@ -273,7 +272,7 @@ test('error, protected', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-error"), lua.to_luastring("binary")); @@ -305,7 +304,7 @@ test('pcall', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-pcall"), lua.to_luastring("binary")); @@ -341,7 +340,7 @@ test('xpcall', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-pcall"), lua.to_luastring("binary")); @@ -383,7 +382,7 @@ test('ipairs', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-ipairs"), lua.to_luastring("binary")); @@ -412,7 +411,7 @@ test('select', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-select"), lua.to_luastring("binary")); @@ -453,7 +452,7 @@ test('tonumber', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-tonumber"), lua.to_luastring("binary")); @@ -500,7 +499,7 @@ test('assert', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-assert"), lua.to_luastring("binary")); @@ -528,7 +527,7 @@ test('rawlen', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-rawlen"), lua.to_luastring("binary")); @@ -575,7 +574,7 @@ test('next', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-next"), lua.to_luastring("binary")); @@ -616,7 +615,7 @@ test('pairs', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-pairs"), lua.to_luastring("binary")); @@ -666,7 +665,7 @@ test('pairs with __pairs', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-pairs"), lua.to_luastring("binary")); diff --git a/tests/lcorolib.js b/tests/lcorolib.js index d2fc8c9..c180897 100644 --- a/tests/lcorolib.js +++ b/tests/lcorolib.js @@ -10,7 +10,6 @@ const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); const lstate = require('../src/lstate.js'); @@ -35,7 +34,7 @@ test('coroutine.create, coroutine.yield, coroutine.resume', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine"), lua.to_luastring("binary")); @@ -78,7 +77,7 @@ test('coroutine.status', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.status"), lua.to_luastring("binary")); @@ -119,7 +118,7 @@ test('coroutine.isyieldable', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.isyieldable"), lua.to_luastring("binary")); @@ -160,7 +159,7 @@ test('coroutine.running', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.running"), lua.to_luastring("binary")); @@ -201,7 +200,7 @@ test('coroutine.wrap', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.wrap"), lua.to_luastring("binary")); diff --git a/tests/ldblib.js b/tests/ldblib.js index 06ad4b3..83d0743 100644 --- a/tests/ldblib.js +++ b/tests/ldblib.js @@ -4,7 +4,6 @@ const test = require('tape'); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); test('debug.sethook', function (t) { let luaCode = ` @@ -29,7 +28,7 @@ test('debug.sethook', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -73,7 +72,7 @@ test('debug.gethook', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -133,7 +132,7 @@ test('debug.getlocal', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -181,7 +180,7 @@ test('debug.setlocal', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -236,7 +235,7 @@ test('debug.upvalueid', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -280,7 +279,7 @@ test('debug.upvaluejoin', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -325,7 +324,7 @@ test('debug.traceback (with a global)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); luaCode = lua.to_luastring(luaCode); lauxlib.luaL_loadbuffer(L, luaCode, luaCode.length, lua.to_luastring("traceback-test")); @@ -384,7 +383,7 @@ test('debug.traceback (with a upvalue)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); luaCode = lua.to_luastring(luaCode); lauxlib.luaL_loadbuffer(L, luaCode, luaCode.length, lua.to_luastring("traceback-test")); @@ -438,7 +437,7 @@ test('debug.getinfo', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); luaCode = lua.to_luastring(luaCode); lauxlib.luaL_loadbuffer(L, luaCode, luaCode.length, lua.to_luastring("getinfo-test")); diff --git a/tests/ldebug.js b/tests/ldebug.js index bee5cd6..dd1ec54 100644 --- a/tests/ldebug.js +++ b/tests/ldebug.js @@ -10,7 +10,6 @@ const toByteCode = tests.toByteCode; const lvm = require("../src/lvm.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); test('luaG_typeerror', function (t) { let luaCode = ` @@ -26,7 +25,7 @@ test('luaG_typeerror', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -56,7 +55,7 @@ test('luaG_typeerror', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -85,7 +84,7 @@ test('luaG_typeerror', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -114,7 +113,7 @@ test('luaG_typeerror', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -142,7 +141,7 @@ test('luaG_concaterror', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -170,7 +169,7 @@ test('luaG_opinterror', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -198,7 +197,7 @@ test('luaG_tointerror', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); diff --git a/tests/lexparse.js b/tests/lexparse.js index ddb2dbf..6c66df2 100644 --- a/tests/lexparse.js +++ b/tests/lexparse.js @@ -9,7 +9,6 @@ const toByteCode = tests.toByteCode; const lua = require("../src/lua.js"); const lapi = require("../src/lapi.js"); const lauxlib = require("../src/lauxlib.js"); -const linit = require('../src/linit.js'); // Roughly the same tests as test/lvm.js to cover all opcodes @@ -25,7 +24,7 @@ test('LOADK, RETURN', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -65,7 +64,7 @@ test('MOVE', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -105,7 +104,7 @@ test('Binary op', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -145,7 +144,7 @@ test('Unary op, LOADBOOL', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -183,7 +182,7 @@ test('NEWTABLE', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -225,7 +224,7 @@ test('CALL', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -271,7 +270,7 @@ test('Multiple return', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -312,7 +311,7 @@ test('TAILCALL', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -353,7 +352,7 @@ test('VARARG', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -392,7 +391,7 @@ test('LE, JMP', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -431,7 +430,7 @@ test('LT', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -470,7 +469,7 @@ test('EQ', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -510,7 +509,7 @@ test('TESTSET (and)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -550,7 +549,7 @@ test('TESTSET (or)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -594,7 +593,7 @@ test('TEST (false)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -637,7 +636,7 @@ test('FORPREP, FORLOOP (int)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -680,7 +679,7 @@ test('FORPREP, FORLOOP (float)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -722,7 +721,7 @@ test('SETTABLE, GETTABLE', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -773,7 +772,7 @@ test('SETUPVAL, GETUPVAL', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -815,7 +814,7 @@ test('SETTABUP, GETTABUP', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -865,7 +864,7 @@ test('SELF', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -904,7 +903,7 @@ test('SETLIST', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -947,7 +946,7 @@ test('Variable SETLIST', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -985,7 +984,7 @@ test('Long SETLIST', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -1040,7 +1039,7 @@ test('TFORCALL, TFORLOOP', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -1081,7 +1080,7 @@ test('LEN', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -1130,7 +1129,7 @@ test('CONCAT', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; diff --git a/tests/lmathlib.js b/tests/lmathlib.js index dd0785c..42f5925 100644 --- a/tests/lmathlib.js +++ b/tests/lmathlib.js @@ -10,7 +10,6 @@ const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); const lstate = require('../src/lstate.js'); @@ -28,7 +27,7 @@ test('math.abs, math.sin, math.cos, math.tan, math.asin, math.acos, math.atan', L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -93,7 +92,7 @@ test('math.ceil, math.floor', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -129,7 +128,7 @@ test('math.deg, math.rad', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -165,7 +164,7 @@ test('math.log', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -207,7 +206,7 @@ test('math.exp', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -237,7 +236,7 @@ test('math.min, math.max', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -273,7 +272,7 @@ test('math.random', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -307,7 +306,7 @@ test('math.sqrt', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -337,7 +336,7 @@ test('math.tointeger', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -367,7 +366,7 @@ test('math.type', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -409,7 +408,7 @@ test('math.ult', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -439,7 +438,7 @@ test('math.fmod', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -469,7 +468,7 @@ test('math.modf', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); diff --git a/tests/load.js b/tests/load.js index 5f0e438..8b9031c 100644 --- a/tests/load.js +++ b/tests/load.js @@ -8,7 +8,6 @@ const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); test('luaL_loadstring', function (t) { @@ -23,7 +22,7 @@ test('luaL_loadstring', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -56,7 +55,7 @@ test('load', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -91,7 +90,7 @@ test('luaL_loadbuffer', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadbuffer(L, bc, null, lua.to_luastring("test")); @@ -124,7 +123,7 @@ test('loadfile', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -157,7 +156,7 @@ test('loadfile (binary)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -189,7 +188,7 @@ test('dofile', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/loslib.js b/tests/loslib.js index 00ee019..968a338 100644 --- a/tests/loslib.js +++ b/tests/loslib.js @@ -4,7 +4,6 @@ const test = require('tape'); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); test('os.time', function (t) { let luaCode = ` @@ -17,7 +16,7 @@ test('os.time', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/lstrlib.js b/tests/lstrlib.js index f4c7ba4..63c8158 100644 --- a/tests/lstrlib.js +++ b/tests/lstrlib.js @@ -8,7 +8,6 @@ const toByteCode = tests.toByteCode; const lua = require("../src/lua.js"); const lauxlib = require("../src/lauxlib.js"); -const linit = require('../src/linit.js'); test('string.len', function (t) { @@ -23,7 +22,7 @@ test('string.len', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -61,7 +60,7 @@ test('string.char', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -92,7 +91,7 @@ test('string.upper, string.lower', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -129,7 +128,7 @@ test('string.rep', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -160,7 +159,7 @@ test('string.reverse', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -191,7 +190,7 @@ test('string.byte', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -234,7 +233,7 @@ test('string.format', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -265,7 +264,7 @@ test('string.format', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -296,7 +295,7 @@ test('string.format', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -337,7 +336,7 @@ test('string.sub', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -436,7 +435,7 @@ test('string.dump', function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode.trim())); @@ -476,7 +475,7 @@ test('string.pack/unpack/packsize', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -512,7 +511,7 @@ test('string.find without pattern', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -549,7 +548,7 @@ test('string.match', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -586,7 +585,7 @@ test('string.find', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -642,7 +641,7 @@ test('string.gmatch', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -691,7 +690,7 @@ test('string.gsub', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -728,7 +727,7 @@ test('string.gsub (number)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -765,7 +764,7 @@ test('string.gsub (pattern)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -804,7 +803,7 @@ test('string.gsub (function)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -843,7 +842,7 @@ test('string.gsub (table)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/ltablib.js b/tests/ltablib.js index 535876a..870d24c 100644 --- a/tests/ltablib.js +++ b/tests/ltablib.js @@ -10,7 +10,6 @@ const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); const lstate = require('../src/lstate.js'); const inttable2array = function(t) { @@ -37,7 +36,7 @@ test('table.concat', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.concat"), lua.to_luastring("binary")); @@ -66,7 +65,7 @@ test('table.pack', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.pack"), lua.to_luastring("binary")); @@ -97,7 +96,7 @@ test('table.unpack', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.unpack"), lua.to_luastring("binary")); @@ -141,7 +140,7 @@ test('table.insert', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.insert"), lua.to_luastring("binary")); @@ -175,7 +174,7 @@ test('table.remove', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.remove"), lua.to_luastring("binary")); @@ -208,7 +207,7 @@ test('table.move', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.move"), lua.to_luastring("binary")); @@ -241,7 +240,7 @@ test('table.sort (<)', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.sort"), lua.to_luastring("binary")); @@ -274,7 +273,7 @@ test('table.sort with cmp function', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.sort"), lua.to_luastring("binary")); diff --git a/tests/ltm.js b/tests/ltm.js index ab68e5e..358e396 100644 --- a/tests/ltm.js +++ b/tests/ltm.js @@ -5,7 +5,6 @@ const beautify = require('js-beautify').js_beautify; const lua = require("../src/lua.js"); const VM = require("../src/lvm.js"); -const linit = require("../src/linit.js"); const lauxlib = require("../src/lauxlib.js"); const OC = require('../src/lopcodes.js'); @@ -27,7 +26,7 @@ test('__index, __newindex: with actual table', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); lua.lua_call(L, 0, -1); @@ -59,7 +58,7 @@ test('__newindex: with non table', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -92,7 +91,7 @@ test('__index function in metatable', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -134,7 +133,7 @@ test('__newindex function in metatable', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -174,7 +173,7 @@ test('__index table in metatable', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -217,7 +216,7 @@ test('__newindex table in metatable', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -271,7 +270,7 @@ test('__index table with own metatable', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -324,7 +323,7 @@ test('__newindex table with own metatable', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -425,7 +424,7 @@ test('binary __xxx functions in metatable', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -477,7 +476,7 @@ test('__eq', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -515,7 +514,7 @@ test('__lt', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -553,7 +552,7 @@ test('__le', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -591,7 +590,7 @@ test('__le that uses __lt', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -633,7 +632,7 @@ test('__unm, __bnot', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -678,7 +677,7 @@ test('__len', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -717,7 +716,7 @@ test('__concat', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -756,7 +755,7 @@ test('__call', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); diff --git a/tests/lua.js b/tests/lua.js index d55b412..0775b3a 100644 --- a/tests/lua.js +++ b/tests/lua.js @@ -5,7 +5,6 @@ const test = require('tape'); const lapi = require("../src/lapi.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); -const linit = require('../src/linit.js'); // TODO: remove @@ -23,7 +22,7 @@ if (false) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -51,7 +50,7 @@ if (false) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -77,7 +76,7 @@ if (false) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/lutf8lib.js b/tests/lutf8lib.js index 4df498c..9449a93 100644 --- a/tests/lutf8lib.js +++ b/tests/lutf8lib.js @@ -5,7 +5,6 @@ const tests = require("./tests.js"); const lua = require("../src/lua.js"); const lauxlib = require("../src/lauxlib.js"); -const linit = require('../src/linit.js'); test('utf8.offset', function (t) { let luaCode = ` @@ -18,7 +17,7 @@ test('utf8.offset', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -50,7 +49,7 @@ test('utf8.codepoint', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -94,7 +93,7 @@ test('utf8.char', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -126,7 +125,7 @@ test('utf8.len', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -163,7 +162,7 @@ test('utf8.codes', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/manual-tests/debug-cli.js b/tests/manual-tests/debug-cli.js index e6e5198..2487a84 100644 --- a/tests/manual-tests/debug-cli.js +++ b/tests/manual-tests/debug-cli.js @@ -2,7 +2,6 @@ const lauxlib = require("../../src/lauxlib.js"); const lua = require('../../src/lua.js'); -const linit = require('../../src/linit.js'); let luaCode = ` a = "debug me" @@ -11,7 +10,7 @@ let luaCode = ` L = lauxlib.luaL_newstate(); -linit.luaL_openlibs(L); +lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/manual-tests/lua-cli.js b/tests/manual-tests/lua-cli.js index 468395f..34b6232 100755 --- a/tests/manual-tests/lua-cli.js +++ b/tests/manual-tests/lua-cli.js @@ -3,7 +3,6 @@ const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); -const linit = require('../../src/linit.js'); const fs = require('fs'); const readlineSync = require('readline-sync'); @@ -141,7 +140,7 @@ if (has_E) { } /* open standard libraries */ -linit.luaL_openlibs(L); +lauxlib.luaL_openlibs(L); /* create table 'arg' */ lua.lua_createtable(L, process.argv.length - (script + 1), script + 1); diff --git a/tests/test-suite/strings.js b/tests/test-suite/strings.js index 0129a4b..471f6d0 100644 --- a/tests/test-suite/strings.js +++ b/tests/test-suite/strings.js @@ -5,7 +5,6 @@ const test = require('tape'); const lapi = require("../../src/lapi.js"); const lauxlib = require("../../src/lauxlib.js"); const lua = require('../../src/lua.js'); -const linit = require('../../src/linit.js'); const checkerror = ` @@ -44,7 +43,7 @@ test('[test-suite] strings: string comparisons', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -86,7 +85,7 @@ test('[test-suite] strings: string.sub', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -124,7 +123,7 @@ test('[test-suite] strings: string.find', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -156,7 +155,7 @@ test('[test-suite] strings: string.len and #', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -213,7 +212,7 @@ test('[test-suite] strings: string.byte/string.char', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -250,7 +249,7 @@ test('[test-suite] strings: repetitions with separator', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -302,7 +301,7 @@ test('[test-suite] strings: tostring', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -349,7 +348,7 @@ test('[test-suite] strings: string.format', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -390,7 +389,7 @@ test('[test-suite] strings: %q', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -417,7 +416,7 @@ test('[test-suite] strings: embedded zeros error', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -460,7 +459,7 @@ test('[test-suite] strings: format x tostring', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -497,7 +496,7 @@ test('[test-suite] strings: longest number that can be formatted', function (t) L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -546,7 +545,7 @@ test('[test-suite] strings: large numbers for format', function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -603,7 +602,7 @@ test("[test-suite] strings: 'format %a %A'", function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -643,7 +642,7 @@ test("[test-suite] strings: errors in format", function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -694,7 +693,7 @@ test("[test-suite] strings: table.concat", function (t) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -751,7 +750,7 @@ if (false) { L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -783,7 +782,7 @@ test("[test-suite] strings: bug in Lua 5.3.2: 'gmatch' iterator does not work ac L = lauxlib.luaL_newstate(); - linit.luaL_openlibs(L); + lauxlib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); -- cgit v1.2.3-54-g00ecf