diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-11 14:02:23 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-11 15:19:18 +1000 |
commit | e7cf17565e26dc5c4a100688526b0dfed1220e44 (patch) | |
tree | ee4606b23f9c62ecf0e6da20dcbf0472d5339fd9 | |
parent | be3f9810115cbaded69be37ebc3d088ee252a225 (diff) | |
download | fengari-e7cf17565e26dc5c4a100688526b0dfed1220e44.tar.gz fengari-e7cf17565e26dc5c4a100688526b0dfed1220e44.tar.bz2 fengari-e7cf17565e26dc5c4a100688526b0dfed1220e44.zip |
Move luaL_openlibs from lauxlib to lualib
-rw-r--r-- | src/fengari.js | 4 | ||||
-rw-r--r-- | src/lauxlib.js | 2 | ||||
-rw-r--r-- | src/linit.js | 26 | ||||
-rw-r--r-- | src/lualib.js | 5 | ||||
-rw-r--r-- | tests/lbaselib.js | 40 | ||||
-rw-r--r-- | tests/lcorolib.js | 17 | ||||
-rw-r--r-- | tests/ldblib.js | 24 | ||||
-rw-r--r-- | tests/ldebug.js | 19 | ||||
-rw-r--r-- | tests/lexparse.js | 63 | ||||
-rw-r--r-- | tests/lmathlib.js | 31 | ||||
-rw-r--r-- | tests/load.js | 17 | ||||
-rw-r--r-- | tests/loadlib.js | 14 | ||||
-rw-r--r-- | tests/loslib.js | 16 | ||||
-rw-r--r-- | tests/lstrlib.js | 47 | ||||
-rw-r--r-- | tests/ltablib.js | 22 | ||||
-rw-r--r-- | tests/ltm.js | 41 | ||||
-rw-r--r-- | tests/lua.js | 15 | ||||
-rw-r--r-- | tests/lutf8lib.js | 11 | ||||
-rw-r--r-- | tests/manual-tests/debug-cli.js | 7 | ||||
-rwxr-xr-x | tests/manual-tests/lua-cli.js | 4 | ||||
-rw-r--r-- | tests/test-suite/calls.js | 37 | ||||
-rw-r--r-- | tests/test-suite/constructs.js | 17 | ||||
-rw-r--r-- | tests/test-suite/events.js | 11 | ||||
-rw-r--r-- | tests/test-suite/locals.js | 15 | ||||
-rw-r--r-- | tests/test-suite/strings.js | 42 | ||||
-rw-r--r-- | tests/test-suite/vararg.js | 13 |
26 files changed, 296 insertions, 264 deletions
diff --git a/src/fengari.js b/src/fengari.js index abbf2a4..3d35334 100644 --- a/src/fengari.js +++ b/src/fengari.js @@ -2,6 +2,8 @@ const lua = require('./lua.js'); const lauxlib = require('./lauxlib.js'); +const lualib = require('./lualib.js'); -module.exports.lua = lua; +module.exports.lua = lua; module.exports.lauxlib = lauxlib; +module.exports.lualib = lualib; diff --git a/src/lauxlib.js b/src/lauxlib.js index 4f55e13..38402c2 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -2,7 +2,6 @@ "use strict"; const lua = require('./lua.js'); -const linit = require('./linit.js'); /* key, in the registry, for table of loaded modules */ const LUA_LOADED_TABLE = "_LOADED"; @@ -798,7 +797,6 @@ 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 4139f20..90ad978 100644 --- a/src/linit.js +++ b/src/linit.js @@ -13,21 +13,21 @@ const loslib = require('./loslib.js'); const loadlib = require('./loadlib.js'); const lualib = require('./lualib.js'); -const loadedlibs = { - [lualib.LUA_LOADLIBNAME]: loadlib.luaopen_package, - [lualib.LUA_COLIBNAME]: lcorolib.luaopen_coroutine, - [lualib.LUA_DBLIBNAME]: ldblib.luaopen_debug, - [lualib.LUA_MATHLIBNAME]: lmathlib.luaopen_math, - [lualib.LUA_OSLIBNAME]: loslib.luaopen_os, - [lualib.LUA_STRLIBNAME]: lstrlib.luaopen_string, - [lualib.LUA_TABLIBNAME]: ltablib.luaopen_table, - [lualib.LUA_UTF8LIBNAME]: lutf8lib.luaopen_utf8, - "_G": lbaselib.luaopen_base -}; +const luaL_openlibs = function(L) { + const loadedlibs = { + [lualib.LUA_LOADLIBNAME]: loadlib.luaopen_package, + [lualib.LUA_COLIBNAME]: lcorolib.luaopen_coroutine, + [lualib.LUA_DBLIBNAME]: ldblib.luaopen_debug, + [lualib.LUA_MATHLIBNAME]: lmathlib.luaopen_math, + [lualib.LUA_OSLIBNAME]: loslib.luaopen_os, + [lualib.LUA_STRLIBNAME]: lstrlib.luaopen_string, + [lualib.LUA_TABLIBNAME]: ltablib.luaopen_table, + [lualib.LUA_UTF8LIBNAME]: lutf8lib.luaopen_utf8, + "_G": lbaselib.luaopen_base + }; -if (!WEB) loadedlibs[lualib.LUA_IOLIBNAME] = require('./liolib.js').luaopen_io; + if (!WEB) loadedlibs[lualib.LUA_IOLIBNAME] = require('./liolib.js').luaopen_io; -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); diff --git a/src/lualib.js b/src/lualib.js index ed02273..b3ba5f8 100644 --- a/src/lualib.js +++ b/src/lualib.js @@ -1,7 +1,8 @@ /*jshint esversion: 6 */ "use strict"; -const lua = require("./lua.js"); +const lua = require("./lua.js"); +const linit = require('./linit.js'); const LUA_VERSUFFIX = "_" + lua.LUA_VERSION_MAJOR + "_" + lua.LUA_VERSION_MINOR; module.exports.LUA_VERSUFFIX = LUA_VERSUFFIX; @@ -47,3 +48,5 @@ module.exports[LUA_DBLIBNAME] = require("./ldblib.js").luaopen_debug; const LUA_LOADLIBNAME = "package"; module.exports.LUA_LOADLIBNAME = LUA_LOADLIBNAME; module.exports[LUA_LOADLIBNAME] = require("./loadlib.js").luaopen_package; + +module.exports.luaL_openlibs = linit.luaL_openlibs; diff --git a/tests/lbaselib.js b/tests/lbaselib.js index ca83467..bfaac9c 100644 --- a/tests/lbaselib.js +++ b/tests/lbaselib.js @@ -5,8 +5,10 @@ const test = require('tape'); const tests = require("./tests.js"); const toByteCode = tests.toByteCode; -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); + test('print', function (t) { let luaCode = ` @@ -21,7 +23,7 @@ test('print', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-print"), lua.to_luastring("binary")); @@ -55,7 +57,7 @@ test('setmetatable, getmetatable', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-setmetatable-getmetatable"), lua.to_luastring("binary")); @@ -100,7 +102,7 @@ test('rawequal', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-rawequal"), lua.to_luastring("binary")); @@ -146,7 +148,7 @@ test('rawset, rawget', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-rawequal"), lua.to_luastring("binary")); @@ -193,7 +195,7 @@ test('type', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-type"), lua.to_luastring("binary")); @@ -246,7 +248,7 @@ test('error', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-error"), lua.to_luastring("binary")); @@ -269,7 +271,7 @@ test('error, protected', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-error"), lua.to_luastring("binary")); @@ -301,7 +303,7 @@ test('pcall', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-pcall"), lua.to_luastring("binary")); @@ -337,7 +339,7 @@ test('xpcall', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-pcall"), lua.to_luastring("binary")); @@ -379,7 +381,7 @@ test('ipairs', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-ipairs"), lua.to_luastring("binary")); @@ -408,7 +410,7 @@ test('select', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-select"), lua.to_luastring("binary")); @@ -453,7 +455,7 @@ test('tonumber', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-tonumber"), lua.to_luastring("binary")); @@ -505,7 +507,7 @@ test('assert', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-assert"), lua.to_luastring("binary")); @@ -533,7 +535,7 @@ test('rawlen', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-rawlen"), lua.to_luastring("binary")); @@ -580,7 +582,7 @@ test('next', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-next"), lua.to_luastring("binary")); @@ -621,7 +623,7 @@ test('pairs', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-pairs"), lua.to_luastring("binary")); @@ -671,7 +673,7 @@ test('pairs with __pairs', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.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 b18b528..342b560 100644 --- a/tests/lcorolib.js +++ b/tests/lcorolib.js @@ -5,9 +5,10 @@ const test = require('tape'); const tests = require("./tests.js"); const toByteCode = tests.toByteCode; -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); -const lstate = require('../src/lstate.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); +const lstate = require('../src/lstate.js'); test('coroutine.create, coroutine.yield, coroutine.resume', function (t) { @@ -31,7 +32,7 @@ test('coroutine.create, coroutine.yield, coroutine.resume', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine"), lua.to_luastring("binary")); @@ -74,7 +75,7 @@ test('coroutine.status', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.status"), lua.to_luastring("binary")); @@ -115,7 +116,7 @@ test('coroutine.isyieldable', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.isyieldable"), lua.to_luastring("binary")); @@ -156,7 +157,7 @@ test('coroutine.running', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.running"), lua.to_luastring("binary")); @@ -197,7 +198,7 @@ test('coroutine.wrap', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.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 1adfef5..f381d8e 100644 --- a/tests/ldblib.js +++ b/tests/ldblib.js @@ -2,8 +2,10 @@ const test = require('tape'); -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); + test('debug.sethook', function (t) { let luaCode = ` @@ -28,7 +30,7 @@ test('debug.sethook', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -72,7 +74,7 @@ test('debug.gethook', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -132,7 +134,7 @@ test('debug.getlocal', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -180,7 +182,7 @@ test('debug.setlocal', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -235,7 +237,7 @@ test('debug.upvalueid', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -279,7 +281,7 @@ test('debug.upvaluejoin', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -324,7 +326,7 @@ test('debug.traceback (with a global)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); luaCode = lua.to_luastring(luaCode); lauxlib.luaL_loadbuffer(L, luaCode, luaCode.length, lua.to_luastring("traceback-test")); @@ -383,7 +385,7 @@ test('debug.traceback (with a upvalue)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); luaCode = lua.to_luastring(luaCode); lauxlib.luaL_loadbuffer(L, luaCode, luaCode.length, lua.to_luastring("traceback-test")); @@ -437,7 +439,7 @@ test('debug.getinfo', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.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 fe6e83d..99e37d9 100644 --- a/tests/ldebug.js +++ b/tests/ldebug.js @@ -5,8 +5,9 @@ const test = require('tape'); const tests = require("./tests.js"); const toByteCode = tests.toByteCode; -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); test('luaG_typeerror', function (t) { let luaCode = ` @@ -22,7 +23,7 @@ test('luaG_typeerror', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -52,7 +53,7 @@ test('luaG_typeerror', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -81,7 +82,7 @@ test('luaG_typeerror', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -110,7 +111,7 @@ test('luaG_typeerror', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -138,7 +139,7 @@ test('luaG_concaterror', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -166,7 +167,7 @@ test('luaG_opinterror', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); @@ -194,7 +195,7 @@ test('luaG_tointerror', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.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 0f13ccd..ecb386f 100644 --- a/tests/lexparse.js +++ b/tests/lexparse.js @@ -5,12 +5,13 @@ const test = require('tape'); const tests = require("./tests.js"); const toByteCode = tests.toByteCode; -const lua = require("../src/lua.js"); -const lapi = require("../src/lapi.js"); -const lauxlib = require("../src/lauxlib.js"); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); +const lapi = require('../src/lapi.js'); -// Roughly the same tests as test/lvm.js to cover all opcodes +// Roughly the same tests as test/lvm.js to cover all opcodes test('LOADK, RETURN', function (t) { let luaCode = ` local a = "hello world" @@ -23,7 +24,7 @@ test('LOADK, RETURN', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -63,7 +64,7 @@ test('MOVE', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -103,7 +104,7 @@ test('Binary op', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -143,7 +144,7 @@ test('Unary op, LOADBOOL', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -181,7 +182,7 @@ test('NEWTABLE', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -223,7 +224,7 @@ test('CALL', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -269,7 +270,7 @@ test('Multiple return', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -310,7 +311,7 @@ test('TAILCALL', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -351,7 +352,7 @@ test('VARARG', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -390,7 +391,7 @@ test('LE, JMP', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -429,7 +430,7 @@ test('LT', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -468,7 +469,7 @@ test('EQ', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -508,7 +509,7 @@ test('TESTSET (and)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -548,7 +549,7 @@ test('TESTSET (or)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -592,7 +593,7 @@ test('TEST (false)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -635,7 +636,7 @@ test('FORPREP, FORLOOP (int)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -678,7 +679,7 @@ test('FORPREP, FORLOOP (float)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -720,7 +721,7 @@ test('SETTABLE, GETTABLE', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -771,7 +772,7 @@ test('SETUPVAL, GETUPVAL', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -813,7 +814,7 @@ test('SETTABUP, GETTABUP', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -863,7 +864,7 @@ test('SELF', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -902,7 +903,7 @@ test('SETLIST', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -945,7 +946,7 @@ test('Variable SETLIST', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -983,7 +984,7 @@ test('Long SETLIST', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -1038,7 +1039,7 @@ test('TFORCALL, TFORLOOP', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -1079,7 +1080,7 @@ test('LEN', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); let reader = function(L, data) { let code = luaCode ? luaCode.trim() : null; @@ -1128,7 +1129,7 @@ test('CONCAT', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.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 f894348..8fcd9a8 100644 --- a/tests/lmathlib.js +++ b/tests/lmathlib.js @@ -5,8 +5,9 @@ const test = require('tape'); const tests = require("./tests.js"); const toByteCode = tests.toByteCode; -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); test('math.abs, math.sin, math.cos, math.tan, math.asin, math.acos, math.atan', function (t) { @@ -23,7 +24,7 @@ test('math.abs, math.sin, math.cos, math.tan, math.asin, math.acos, math.atan', L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -88,7 +89,7 @@ test('math.ceil, math.floor', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -124,7 +125,7 @@ test('math.deg, math.rad', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -160,7 +161,7 @@ test('math.log', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -202,7 +203,7 @@ test('math.exp', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -232,7 +233,7 @@ test('math.min, math.max', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -268,7 +269,7 @@ test('math.random', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -302,7 +303,7 @@ test('math.sqrt', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -332,7 +333,7 @@ test('math.tointeger', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -362,7 +363,7 @@ test('math.type', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -404,7 +405,7 @@ test('math.ult', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -434,7 +435,7 @@ test('math.fmod', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-math"), lua.to_luastring("binary")); @@ -464,7 +465,7 @@ test('math.modf', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.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 5f44bfa..a385959 100644 --- a/tests/load.js +++ b/tests/load.js @@ -5,8 +5,9 @@ const test = require('tape'); const tests = require("./tests.js"); const toByteCode = tests.toByteCode; -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); test('luaL_loadstring', function (t) { @@ -21,7 +22,7 @@ test('luaL_loadstring', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -54,7 +55,7 @@ test('load', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -89,7 +90,7 @@ test('luaL_loadbuffer', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadbuffer(L, bc, null, lua.to_luastring("test")); @@ -122,7 +123,7 @@ test('loadfile', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -155,7 +156,7 @@ test('loadfile (binary)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -187,7 +188,7 @@ test('dofile', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/loadlib.js b/tests/loadlib.js index ee87b4a..5854519 100644 --- a/tests/loadlib.js +++ b/tests/loadlib.js @@ -2,8 +2,10 @@ const test = require('tape'); -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); + test('require an existing module', function (t) { let luaCode = ` @@ -16,7 +18,7 @@ test('require an existing module', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -47,7 +49,7 @@ test('require a file', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -79,7 +81,7 @@ test('package.loadlib', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -111,7 +113,7 @@ test('package.searchpath', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/loslib.js b/tests/loslib.js index a80ccad..24e73c8 100644 --- a/tests/loslib.js +++ b/tests/loslib.js @@ -2,8 +2,10 @@ const test = require('tape'); -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); + test('os.time', function (t) { let luaCode = ` @@ -16,7 +18,7 @@ test('os.time', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -51,7 +53,7 @@ test('os.time (with format)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -85,7 +87,7 @@ test('os.difftime', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -120,7 +122,7 @@ test('os.date', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -152,7 +154,7 @@ test('os.getenv', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/lstrlib.js b/tests/lstrlib.js index 1012f65..dbd27d9 100644 --- a/tests/lstrlib.js +++ b/tests/lstrlib.js @@ -2,8 +2,9 @@ const test = require('tape'); -const lua = require("../src/lua.js"); -const lauxlib = require("../src/lauxlib.js"); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); test('string.len', function (t) { @@ -18,7 +19,7 @@ test('string.len', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -56,7 +57,7 @@ test('string.char', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -87,7 +88,7 @@ test('string.upper, string.lower', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -124,7 +125,7 @@ test('string.rep', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -155,7 +156,7 @@ test('string.reverse', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -186,7 +187,7 @@ test('string.byte', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -229,7 +230,7 @@ test('string.format', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -260,7 +261,7 @@ test('string.format', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -291,7 +292,7 @@ test('string.format', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -332,7 +333,7 @@ test('string.sub', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -431,7 +432,7 @@ test('string.dump', function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode.trim())); @@ -471,7 +472,7 @@ test('string.pack/unpack/packsize', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -507,7 +508,7 @@ test('string.find without pattern', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -544,7 +545,7 @@ test('string.match', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -581,7 +582,7 @@ test('string.find', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -637,7 +638,7 @@ test('string.gmatch', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -686,7 +687,7 @@ test('string.gsub', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -723,7 +724,7 @@ test('string.gsub (number)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -760,7 +761,7 @@ test('string.gsub (pattern)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -799,7 +800,7 @@ test('string.gsub (function)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -838,7 +839,7 @@ test('string.gsub (table)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/ltablib.js b/tests/ltablib.js index 15f9e57..8789f9e 100644 --- a/tests/ltablib.js +++ b/tests/ltablib.js @@ -5,8 +5,10 @@ const test = require('tape'); const tests = require("./tests.js"); const toByteCode = tests.toByteCode; -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); + const inttable2array = function(t) { let a = []; @@ -32,7 +34,7 @@ test('table.concat', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.concat"), lua.to_luastring("binary")); @@ -61,7 +63,7 @@ test('table.pack', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.pack"), lua.to_luastring("binary")); @@ -92,7 +94,7 @@ test('table.unpack', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.unpack"), lua.to_luastring("binary")); @@ -136,7 +138,7 @@ test('table.insert', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.insert"), lua.to_luastring("binary")); @@ -170,7 +172,7 @@ test('table.remove', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.remove"), lua.to_luastring("binary")); @@ -203,7 +205,7 @@ test('table.move', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.move"), lua.to_luastring("binary")); @@ -236,7 +238,7 @@ test('table.sort (<)', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test-table.sort"), lua.to_luastring("binary")); @@ -269,7 +271,7 @@ test('table.sort with cmp function', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.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 b55e16a..b1150e7 100644 --- a/tests/ltm.js +++ b/tests/ltm.js @@ -2,12 +2,13 @@ const test = require('tape'); -const lua = require("../src/lua.js"); -const lauxlib = require("../src/lauxlib.js"); - const tests = require("./tests.js"); const toByteCode = tests.toByteCode; +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); + test('__index, __newindex: with actual table', function (t) { let luaCode = ` @@ -22,7 +23,7 @@ test('__index, __newindex: with actual table', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); lua.lua_call(L, 0, -1); @@ -54,7 +55,7 @@ test('__newindex: with non table', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -87,7 +88,7 @@ test('__index function in metatable', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -129,7 +130,7 @@ test('__newindex function in metatable', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -169,7 +170,7 @@ test('__index table in metatable', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -212,7 +213,7 @@ test('__newindex table in metatable', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -266,7 +267,7 @@ test('__index table with own metatable', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -319,7 +320,7 @@ test('__newindex table with own metatable', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -420,7 +421,7 @@ test('binary __xxx functions in metatable', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -472,7 +473,7 @@ test('__eq', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -510,7 +511,7 @@ test('__lt', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -548,7 +549,7 @@ test('__le', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -586,7 +587,7 @@ test('__le that uses __lt', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -628,7 +629,7 @@ test('__unm, __bnot', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -673,7 +674,7 @@ test('__len', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -712,7 +713,7 @@ test('__concat', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lua.lua_load(L, null, bc, lua.to_luastring("test"), lua.to_luastring("binary")); }, "Bytecode parsed without errors"); @@ -751,7 +752,7 @@ test('__call', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.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 0775b3a..487f748 100644 --- a/tests/lua.js +++ b/tests/lua.js @@ -2,12 +2,13 @@ const test = require('tape'); -const lapi = require("../src/lapi.js"); -const lauxlib = require("../src/lauxlib.js"); -const lua = require('../src/lua.js'); +const lua = require('../src/lua.js'); +const lauxlib = require('../src/lauxlib.js'); +const lualib = require('../src/lualib.js'); +const lapi = require('../src/lapi.js'); -// TODO: remove +// TODO: remove if (false) { test('locals.lua', function (t) { let luaCode = ` @@ -22,7 +23,7 @@ if (false) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -50,7 +51,7 @@ if (false) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -76,7 +77,7 @@ if (false) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/lutf8lib.js b/tests/lutf8lib.js index 28a45a5..cff7472 100644 --- a/tests/lutf8lib.js +++ b/tests/lutf8lib.js @@ -4,6 +4,7 @@ const test = require('tape'); const lua = require("../src/lua.js"); const lauxlib = require("../src/lauxlib.js"); +const lualib = require("../src/lualib.js"); test('utf8.offset', function (t) { let luaCode = ` @@ -16,7 +17,7 @@ test('utf8.offset', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -48,7 +49,7 @@ test('utf8.codepoint', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -92,7 +93,7 @@ test('utf8.char', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -124,7 +125,7 @@ test('utf8.len', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -161,7 +162,7 @@ test('utf8.codes', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.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 2487a84..0bedf50 100644 --- a/tests/manual-tests/debug-cli.js +++ b/tests/manual-tests/debug-cli.js @@ -1,7 +1,8 @@ "use strict"; -const lauxlib = require("../../src/lauxlib.js"); -const lua = require('../../src/lua.js'); +const lua = require('../../src/lua.js'); +const lauxlib = require('../../src/lauxlib.js'); +const lualib = require('../../src/lualib.js'); let luaCode = ` a = "debug me" @@ -10,7 +11,7 @@ let luaCode = ` L = lauxlib.luaL_newstate(); -lauxlib.luaL_openlibs(L); +lualib.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 378b5f7..a518745 100755 --- a/tests/manual-tests/lua-cli.js +++ b/tests/manual-tests/lua-cli.js @@ -5,6 +5,8 @@ global.WEB = false; const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); +const lualib = require('../../src/lualib.js'); + const readlineSync = require('readline-sync'); const stdin = lua.to_luastring("=stdin"); @@ -158,7 +160,7 @@ if (has_E) { } /* open standard libraries */ -lauxlib.luaL_openlibs(L); +lualib.luaL_openlibs(L); /* create table 'arg' */ lua.lua_createtable(L, process.argv.length - (script + 1), script + 1); diff --git a/tests/test-suite/calls.js b/tests/test-suite/calls.js index 63d7f35..451f6c0 100644 --- a/tests/test-suite/calls.js +++ b/tests/test-suite/calls.js @@ -4,8 +4,9 @@ const test = require('tape'); global.WEB = false; -const lauxlib = require("../../src/lauxlib.js"); -const lua = require('../../src/lua.js'); +const lua = require('../../src/lua.js'); +const lauxlib = require('../../src/lauxlib.js'); +const lualib = require('../../src/lualib.js'); test("[test-suite] calls: test 'type'", function (t) { @@ -30,7 +31,7 @@ test("[test-suite] calls: test 'type'", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -68,7 +69,7 @@ test("[test-suite] calls: test error in 'print'", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -104,7 +105,7 @@ test("[test-suite] calls: testing local-function recursion", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -211,7 +212,7 @@ test("[test-suite] calls: testing declarations", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -269,7 +270,7 @@ test("[test-suite] calls: testing closures", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -327,7 +328,7 @@ test("[test-suite] calls: testing multiple returns", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -356,7 +357,7 @@ test("[test-suite] calls: testing calls with 'incorrect' arguments", function (t L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -428,7 +429,7 @@ test("[test-suite] calls: test for generic load", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -454,7 +455,7 @@ test("[test-suite] calls: any value is valid for _ENV", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -491,7 +492,7 @@ test("[test-suite] calls: load when _ENV is not first upvalue", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -536,7 +537,7 @@ test("[test-suite] calls: test generic load with nested functions", function (t) L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -576,7 +577,7 @@ test("[test-suite] calls: test for dump/undump with upvalues", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -623,7 +624,7 @@ test("[test-suite] calls: test for dump/undump with many upvalues", function (t) L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -655,7 +656,7 @@ test("[test-suite] calls: test for long method names", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -683,7 +684,7 @@ test("[test-suite] calls: test for bug in parameter adjustment", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -742,7 +743,7 @@ test("[test-suite] calls: testing binary chunks", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/test-suite/constructs.js b/tests/test-suite/constructs.js index b6a44cf..d260843 100644 --- a/tests/test-suite/constructs.js +++ b/tests/test-suite/constructs.js @@ -4,8 +4,9 @@ const test = require('tape'); global.WEB = false; -const lauxlib = require("../../src/lauxlib.js"); -const lua = require('../../src/lua.js'); +const lua = require('../../src/lua.js'); +const lauxlib = require('../../src/lauxlib.js'); +const lualib = require('../../src/lualib.js'); const checkload = ` @@ -27,7 +28,7 @@ test('[test-suite] constructs: testing semicolons', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkload + luaCode)); @@ -53,7 +54,7 @@ test('[test-suite] constructs: invalid operations should not raise errors when n L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkload + luaCode)); @@ -118,7 +119,7 @@ test('[test-suite] constructs: testing priorities', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkload + luaCode)); @@ -304,7 +305,7 @@ test('[test-suite] constructs: silly loops', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkload + luaCode)); @@ -393,7 +394,7 @@ if (false) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkload + luaCode)); @@ -430,7 +431,7 @@ test("[test-suite] constructs: testing some syntax errors (chosen through 'gcov' L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkload + luaCode)); diff --git a/tests/test-suite/events.js b/tests/test-suite/events.js index 3c9a590..d7dfe15 100644 --- a/tests/test-suite/events.js +++ b/tests/test-suite/events.js @@ -4,8 +4,9 @@ const test = require('tape'); global.WEB = false; -const lauxlib = require("../../src/lauxlib.js"); -const lua = require('../../src/lua.js'); +const lua = require('../../src/lua.js'); +const lauxlib = require('../../src/lauxlib.js'); +const lualib = require('../../src/lualib.js'); test("[test-suite] events: testing metatable", function (t) { @@ -188,7 +189,7 @@ test("[test-suite] events: testing metatable", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -222,7 +223,7 @@ test("[test-suite] events: test for rawlen", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -283,7 +284,7 @@ test("[test-suite] events: test comparison", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); diff --git a/tests/test-suite/locals.js b/tests/test-suite/locals.js index 78eb24d..3815f5d 100644 --- a/tests/test-suite/locals.js +++ b/tests/test-suite/locals.js @@ -4,8 +4,9 @@ const test = require('tape'); global.WEB = false; -const lauxlib = require("../../src/lauxlib.js"); -const lua = require('../../src/lua.js'); +const lua = require('../../src/lua.js'); +const lauxlib = require('../../src/lauxlib.js'); +const lualib = require('../../src/lualib.js'); test('[test-suite] locals: bug in 5.1', function (t) { @@ -26,7 +27,7 @@ test('[test-suite] locals: bug in 5.1', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -98,7 +99,7 @@ test('[test-suite] locals: local scope', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -138,7 +139,7 @@ test('[test-suite] locals: test for global table of loaded chunks', function (t) L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(getenv + luaCode)); @@ -181,7 +182,7 @@ test('[test-suite] locals: old test for limits for special instructions (now jus L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -235,7 +236,7 @@ test('[test-suite] locals: testing lexical environments', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(getenv + luaCode)); diff --git a/tests/test-suite/strings.js b/tests/test-suite/strings.js index 033b324..a0d057c 100644 --- a/tests/test-suite/strings.js +++ b/tests/test-suite/strings.js @@ -4,8 +4,10 @@ const test = require('tape'); global.WEB = false; -const lauxlib = require("../../src/lauxlib.js"); -const lua = require('../../src/lua.js'); +const lua = require('../../src/lua.js'); +const lauxlib = require('../../src/lauxlib.js'); +const lualib = require('../../src/lualib.js'); + const checkerror = ` local maxi, mini = math.maxinteger, math.mininteger @@ -43,7 +45,7 @@ test('[test-suite] strings: string comparisons', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -85,7 +87,7 @@ test('[test-suite] strings: string.sub', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -123,7 +125,7 @@ test('[test-suite] strings: string.find', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -155,7 +157,7 @@ test('[test-suite] strings: string.len and #', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -212,7 +214,7 @@ test('[test-suite] strings: string.byte/string.char', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -249,7 +251,7 @@ test('[test-suite] strings: repetitions with separator', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -301,7 +303,7 @@ test('[test-suite] strings: tostring', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -348,7 +350,7 @@ test('[test-suite] strings: string.format', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -389,7 +391,7 @@ test('[test-suite] strings: %q', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -416,7 +418,7 @@ test('[test-suite] strings: embedded zeros error', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -459,7 +461,7 @@ test('[test-suite] strings: format x tostring', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -496,7 +498,7 @@ test('[test-suite] strings: longest number that can be formatted', function (t) L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -545,7 +547,7 @@ test('[test-suite] strings: large numbers for format', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -602,7 +604,7 @@ test("[test-suite] strings: 'format %a %A'", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -642,7 +644,7 @@ test("[test-suite] strings: errors in format", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -693,7 +695,7 @@ test("[test-suite] strings: table.concat", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -750,7 +752,7 @@ if (false) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); @@ -782,7 +784,7 @@ test("[test-suite] strings: bug in Lua 5.3.2: 'gmatch' iterator does not work ac L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); diff --git a/tests/test-suite/vararg.js b/tests/test-suite/vararg.js index 0dab1b6..3b147bc 100644 --- a/tests/test-suite/vararg.js +++ b/tests/test-suite/vararg.js @@ -4,8 +4,9 @@ const test = require('tape'); global.WEB = false; -const lauxlib = require("../../src/lauxlib.js"); -const lua = require('../../src/lua.js'); +const lua = require('../../src/lua.js'); +const lauxlib = require('../../src/lauxlib.js'); +const lualib = require('../../src/lualib.js'); test("[test-suite] vararg: testing vararg", function (t) { @@ -82,7 +83,7 @@ test("[test-suite] vararg: testing vararg", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -127,7 +128,7 @@ test("[test-suite] vararg: new-style varargs", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -177,7 +178,7 @@ test("[test-suite] vararg: varargs for main chunks", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); @@ -213,7 +214,7 @@ test("[test-suite] vararg: bug in 5.2.2", function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_openlibs(L); + lualib.luaL_openlibs(L); lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); |