From 31dcd12f5a9cd6a45e8ad9d1213a8a25d88fe885 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Mon, 24 Apr 2017 15:11:12 +0200 Subject: Removed useless luac -l from tests --- tests/lapi.js | 4 ++-- tests/lbaselib.js | 34 +++++++++++++++++----------------- tests/lcorolib.js | 10 +++++----- tests/ldebug.js | 14 +++++++------- tests/lmathlib.js | 26 +++++++++++++------------- tests/load.js | 2 +- tests/ltablib.js | 16 ++++++++-------- tests/ltm.js | 34 +++++++++++++++++----------------- tests/tests.js | 14 +++----------- 9 files changed, 73 insertions(+), 81 deletions(-) (limited to 'tests') diff --git a/tests/lapi.js b/tests/lapi.js index c6e9c53..28f8887 100644 --- a/tests/lapi.js +++ b/tests/lapi.js @@ -378,7 +378,7 @@ test('lua_load and lua_call it', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -405,7 +405,7 @@ test('lua script reads js upvalues', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); diff --git a/tests/lbaselib.js b/tests/lbaselib.js index 5f39991..cc7847e 100644 --- a/tests/lbaselib.js +++ b/tests/lbaselib.js @@ -24,7 +24,7 @@ test('print', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -58,7 +58,7 @@ test('setmetatable, getmetatable', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -103,7 +103,7 @@ test('rawequal', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -149,7 +149,7 @@ test('rawset, rawget', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -196,7 +196,7 @@ test('type', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -249,7 +249,7 @@ test('error', function (t) { t.throws(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -272,7 +272,7 @@ test('error, protected', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -304,7 +304,7 @@ test('pcall', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -340,7 +340,7 @@ test('xpcall', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -382,7 +382,7 @@ test('ipairs', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -411,7 +411,7 @@ test('select', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -452,7 +452,7 @@ test('tonumber', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -499,7 +499,7 @@ test('assert', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -527,7 +527,7 @@ test('rawlen', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -574,7 +574,7 @@ test('next', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -615,7 +615,7 @@ test('pairs', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -665,7 +665,7 @@ test('pairs with __pairs', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); diff --git a/tests/lcorolib.js b/tests/lcorolib.js index f709fa5..d97e681 100644 --- a/tests/lcorolib.js +++ b/tests/lcorolib.js @@ -34,7 +34,7 @@ test('coroutine.create, coroutine.yield, coroutine.resume', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -77,7 +77,7 @@ test('coroutine.status', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -118,7 +118,7 @@ test('coroutine.isyieldable', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -159,7 +159,7 @@ test('coroutine.running', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -200,7 +200,7 @@ test('coroutine.wrap', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); diff --git a/tests/ldebug.js b/tests/ldebug.js index e24b584..0256465 100644 --- a/tests/ldebug.js +++ b/tests/ldebug.js @@ -24,7 +24,7 @@ test('luaG_typeerror', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -54,7 +54,7 @@ test('luaG_typeerror', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -83,7 +83,7 @@ test('luaG_typeerror', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -112,7 +112,7 @@ test('luaG_typeerror', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -140,7 +140,7 @@ test('luaG_concaterror', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -168,7 +168,7 @@ test('luaG_opinterror', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -196,7 +196,7 @@ test('luaG_tointerror', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); diff --git a/tests/lmathlib.js b/tests/lmathlib.js index 6105af4..339718c 100644 --- a/tests/lmathlib.js +++ b/tests/lmathlib.js @@ -27,7 +27,7 @@ test('math.abs, math.sin, math.cos, math.tan, math.asin, math.acos, math.atan', t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -92,7 +92,7 @@ test('math.ceil, math.floor', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -128,7 +128,7 @@ test('math.deg, math.rad', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -164,7 +164,7 @@ test('math.log', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -206,7 +206,7 @@ test('math.exp', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -236,7 +236,7 @@ test('math.min, math.max', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -272,7 +272,7 @@ test('math.random', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -306,7 +306,7 @@ test('math.sqrt', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -336,7 +336,7 @@ test('math.tointeger', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -366,7 +366,7 @@ test('math.type', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -408,7 +408,7 @@ test('math.ult', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -438,7 +438,7 @@ test('math.fmod', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -468,7 +468,7 @@ test('math.modf', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); diff --git a/tests/load.js b/tests/load.js index 00ed90a..839a962 100644 --- a/tests/load.js +++ b/tests/load.js @@ -90,7 +90,7 @@ test('luaL_loadbuffer', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); diff --git a/tests/ltablib.js b/tests/ltablib.js index 60f9abc..cb7b064 100644 --- a/tests/ltablib.js +++ b/tests/ltablib.js @@ -36,7 +36,7 @@ test('table.concat', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -65,7 +65,7 @@ test('table.pack', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -96,7 +96,7 @@ test('table.unpack', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -140,7 +140,7 @@ test('table.insert', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -174,7 +174,7 @@ test('table.remove', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -207,7 +207,7 @@ test('table.move', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -240,7 +240,7 @@ test('table.sort (<)', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -273,7 +273,7 @@ test('table.sort with cmp function', function (t) { t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); diff --git a/tests/ltm.js b/tests/ltm.js index 501b062..92be806 100644 --- a/tests/ltm.js +++ b/tests/ltm.js @@ -26,7 +26,7 @@ test('__index, __newindex: with actual table', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -60,7 +60,7 @@ test('__newindex: with non table', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -95,7 +95,7 @@ test('__index function in metatable', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -139,7 +139,7 @@ test('__newindex function in metatable', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -181,7 +181,7 @@ test('__index table in metatable', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -226,7 +226,7 @@ test('__newindex table in metatable', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -282,7 +282,7 @@ test('__index table with own metatable', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -337,7 +337,7 @@ test('__newindex table with own metatable', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -440,7 +440,7 @@ test('binary __xxx functions in metatable', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -494,7 +494,7 @@ test('__eq', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -534,7 +534,7 @@ test('__lt', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -574,7 +574,7 @@ test('__le', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -614,7 +614,7 @@ test('__le that uses __lt', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -658,7 +658,7 @@ test('__unm, __bnot', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -705,7 +705,7 @@ test('__len', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -746,7 +746,7 @@ test('__concat', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); @@ -787,7 +787,7 @@ test('__call', function (t) { t.comment("Running following code: \n" + luaCode); t.doesNotThrow(function () { - let bc = toByteCode(luaCode).dataView; + let bc = toByteCode(luaCode); L = lauxlib.luaL_newstate(); diff --git a/tests/tests.js b/tests/tests.js index 40bebd8..32efca1 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -15,23 +15,15 @@ const toByteCode = function (luaCode) { fs.writeSync(luaFile.fd, luaCode); child_process.execSync(`luac -o ${luaFile.name}.bc ${luaFile.name}`); - child_process.execSync(`luac -l ${luaFile.name} > ${luaFile.name}.bc.txt`); - - bclist = fs.readFileSync(`${luaFile.name}.bc.txt`, 'utf8'); let b = fs.readFileSync(`${luaFile.name}.bc`); let dv = new DataView(b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength)); - return { - dataView: dv, - bclist: bclist - }; + return dv; }; const getState = function(luaCode) { - var bc = toByteCode(luaCode), - dv = bc.dataView, - bcl = bc.bclist; + var dv = toByteCode(luaCode); let L = lauxlib.luaL_newstate(); @@ -41,4 +33,4 @@ const getState = function(luaCode) { }; module.exports.getState = getState; -module.exports.toByteCode = toByteCode; \ No newline at end of file +module.exports.toByteCode = toByteCode; -- cgit v1.2.3-54-g00ecf