diff options
69 files changed, 1500 insertions, 1102 deletions
diff --git a/.travis.yml b/.travis.yml index f9bcfe7..cb33e24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ install: - yarn script: + - yarn lint - yarn build - travis_wait yarn test diff --git a/package.json b/package.json index 527debf..6bbad0a 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "scripts": { "build": "webpack", + "lint": "eslint src/ tests/", "test": "tape tests/*.js tests/test-suite/*.js | faucet", "test-inprogress": "tape tests/test-suite/inprogress/*.js | faucet" }, @@ -32,6 +33,7 @@ "babel-core": "^6.26.0", "babel-loader": "^7.1.1", "babel-preset-env": "^1.6.0", + "eslint": "^4.13.0", "faucet": "^0.0.1", "tape": "^4.8.0", "webpack": "^3.5.5" @@ -42,11 +44,36 @@ "strftime": "^0.10.0", "tmp": "^0.0.33" }, - "jshintConfig": { - "node": true, - "esversion": 6, - "indent": false, - "unused": true, - "white": false + "eslintConfig": { + "env": { + "browser": true, + "es6": true, + "node": true + }, + "extends": "eslint:recommended", + "rules": { + "indent": [ + "error", + 4, + {"SwitchCase": 1} + ], + "linebreak-style": [ + "error", + "unix" + ], + "no-console": 0, + "no-empty": [ + 2, + { "allowEmptyCatch": true } + ], + "no-unused-vars": [ + 2, + { "args": "none" } + ], + "semi": [ + "error", + "always" + ] + } } } diff --git a/src/defs.js b/src/defs.js index 3ebb747..268e76e 100644 --- a/src/defs.js +++ b/src/defs.js @@ -291,7 +291,7 @@ module.exports.LUA_EXEC_DIR = LUA_EXEC_DIR; const LUA_VDIR = LUA_VERSION_MAJOR + "." + LUA_VERSION_MINOR; module.exports.LUA_VDIR = LUA_VDIR; -if (WEB) { +if (typeof process === "undefined") { const LUA_DIRSEP = "/"; module.exports.LUA_DIRSEP = LUA_DIRSEP; diff --git a/src/lapi.js b/src/lapi.js index be80672..2ae5b3c 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -128,8 +128,8 @@ const lua_xmove = function(from, to, n) { */ const lua_absindex = function(L, idx) { return (idx > 0 || idx <= defs.LUA_REGISTRYINDEX) - ? idx - : (L.top - L.ci.funcOff) + idx; + ? idx + : (L.top - L.ci.funcOff) + idx; }; const lua_gettop = function(L) { diff --git a/src/lauxlib.js b/src/lauxlib.js index d976cee..0c42a05 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -493,13 +493,14 @@ const luaL_tolstring = function(L, idx) { case lua.LUA_TNIL: lua.lua_pushliteral(L, "nil"); break; - default: + default: { let tt = luaL_getmetafield(L, idx, lua.to_luastring("__name", true)); let kind = tt === lua.LUA_TSTRING ? lua.lua_tostring(L, -1) : luaL_typename(L, idx); lua.lua_pushfstring(L, lua.to_luastring("%s: %p"), kind, lua.lua_topointer(L, idx)); if (tt !== lua.LUA_TNIL) lua.lua_remove(L, -2); break; + } } } @@ -708,13 +709,13 @@ class LoadF { constructor() { this.n = NaN; /* number of pre-read characters */ this.f = null; /* file being read */ - this.buff = WEB ? new Array(1024) : new Buffer(1024); /* area for reading file */ + this.buff = typeof process === "undefined" ? new Array(1024) : new Buffer(1024); /* area for reading file */ this.pos = 0; /* current position in file */ this.err = void 0; } } -if (WEB) { +if (typeof process === "undefined") { const getF = function(L, ud) { let lf = ud; @@ -858,7 +859,7 @@ const luaL_dofile = function(L, filename) { const lua_writestringerror = function() { for (let i=0; i<arguments.length; i++) { let a = arguments[i]; - if (WEB) { + if (typeof process === "undefined") { if (typeof a !== "string") a = lua.to_jsstring(a); console.error(a); diff --git a/src/lbaselib.js b/src/lbaselib.js index c598474..54e73b1 100644 --- a/src/lbaselib.js +++ b/src/lbaselib.js @@ -5,7 +5,7 @@ const lauxlib = require('./lauxlib.js'); let lua_writestring; let lua_writeline; -if (WEB) { +if (typeof process === "undefined") { let buff = []; lua_writestring = function(s) { buff = buff.concat(s); @@ -99,9 +99,11 @@ const luaB_rawset = function(L) { return 1; }; -const opts = ["stop", "restart", "collect", -"count", "step", "setpause", "setstepmul", -"isrunning"].map((e) => lua.to_luastring(e)); +const opts = [ + "stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", + "isrunning" +].map((e) => lua.to_luastring(e)); const luaB_collectgarbage = function(L) { lauxlib.luaL_checkoption(L, 1, lua.to_luastring("collect"), opts); lauxlib.luaL_optinteger(L, 2, 0); @@ -174,14 +176,15 @@ const b_str2int = function(s, base) { } catch (e) { return null; } - let r = /^[\t\v\f \n\r]*([\+\-]?)0*([0-9A-Za-z]+)[\t\v\f \n\r]*$/.exec(s); + let r = /^[\t\v\f \n\r]*([+-]?)0*([0-9A-Za-z]+)[\t\v\f \n\r]*$/.exec(s); if (!r) return null; let neg = r[1] === "-"; let digits = r[2]; let n = 0; for (let si=0; si<digits.length; si++) { - let digit = /\d/.test(digits[si]) ? (digits.charCodeAt(si) - '0'.charCodeAt(0)) - : (digits[si].toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) + 10); + let digit = /\d/.test(digits[si]) + ? (digits.charCodeAt(si) - '0'.charCodeAt(0)) + : (digits[si].toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) + 10); if (digit >= base) return null; /* invalid numeral */ n = ((n * base)|0) + digit; } diff --git a/src/lcode.js b/src/lcode.js index 60b7452..e7259f2 100644 --- a/src/lcode.js +++ b/src/lcode.js @@ -189,8 +189,8 @@ const luaK_ret = function(fs, first, nret) { ** followed by a jump. Return jump position. */ const condjump = function(fs, op, A, B, C) { - luaK_codeABC(fs, op, A, B, C); - return luaK_jump(fs); + luaK_codeABC(fs, op, A, B, C); + return luaK_jump(fs); }; /* @@ -389,8 +389,8 @@ const luaK_checkstack = function(fs, n) { ** Reserve 'n' registers in register stack */ const luaK_reserveregs = function(fs, n) { - luaK_checkstack(fs, n); - fs.freereg += n; + luaK_checkstack(fs, n); + fs.freereg += n; }; /* @@ -785,7 +785,7 @@ const luaK_storevar = function(fs, vr, ex) { case ek.VUPVAL: { let e = luaK_exp2anyreg(fs, ex); luaK_codeABC(fs, OpCodesI.OP_SETUPVAL, e, vr.u.info, 0); - break; + break; } case ek.VINDEXED: { let op = (vr.u.ind.vt === ek.VLOCAL) ? OpCodesI.OP_SETTABLE : OpCodesI.OP_SETTABUP; @@ -850,17 +850,17 @@ const luaK_goiftrue = function(fs, e) { luaK_dischargevars(fs, e); switch (e.k) { case ek.VJMP: { /* condition? */ - negatecondition(fs, e); /* jump when it is false */ - pc = e.u.info; /* save jump position */ - break; + negatecondition(fs, e); /* jump when it is false */ + pc = e.u.info; /* save jump position */ + break; } case ek.VK: case ek.VKFLT: case ek.VKINT: case ek.VTRUE: { - pc = NO_JUMP; /* always true; do nothing */ - break; + pc = NO_JUMP; /* always true; do nothing */ + break; } default: { - pc = jumponcond(fs, e, 0); /* jump when false */ - break; + pc = jumponcond(fs, e, 0); /* jump when false */ + break; } } e.f = luaK_concat(fs, e.f, pc); /* insert new jump in false list */ @@ -989,11 +989,11 @@ const constfolding = function(op, e1, e2) { ** Expression to produce final result will be encoded in 'e'. */ const codeunexpval = function(fs, op, e, line) { - let r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */ - freeexp(fs, e); - e.u.info = luaK_codeABC(fs, op, 0, r, 0); /* generate opcode */ - e.k = lparser.expkind.VRELOCABLE; /* all those operations are relocatable */ - luaK_fixline(fs, line); + let r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */ + freeexp(fs, e); + e.u.info = luaK_codeABC(fs, op, 0, r, 0); /* generate opcode */ + e.k = lparser.expkind.VRELOCABLE; /* all those operations are relocatable */ + luaK_fixline(fs, line); }; /* diff --git a/src/ldblib.js b/src/ldblib.js index 2faa9f0..96db3c7 100644 --- a/src/ldblib.js +++ b/src/ldblib.js @@ -46,11 +46,11 @@ const db_getuservalue = function(L) { const db_setuservalue = function(L) { - lauxlib.luaL_checktype(L, 1, lua.LUA_TUSERDATA); - lauxlib.luaL_checkany(L, 2); - lua.lua_settop(L, 2); - lua.lua_setuservalue(L, 1); - return 1; + lauxlib.luaL_checktype(L, 1, lua.LUA_TUSERDATA); + lauxlib.luaL_checkany(L, 2); + lua.lua_settop(L, 2); + lua.lua_setuservalue(L, 1); + return 1; }; /* @@ -247,9 +247,9 @@ const checkupval = function(L, argf, argnup) { }; const db_upvalueid = function(L) { - let n = checkupval(L, 1, 2); - lua.lua_pushlightuserdata(L, lua.lua_upvalueid(L, 1, n)); - return 1; + let n = checkupval(L, 1, 2); + lua.lua_pushlightuserdata(L, lua.lua_upvalueid(L, 1, n)); + return 1; }; const db_upvaluejoin = function(L) { @@ -395,8 +395,7 @@ const dblib = { "upvaluejoin": db_upvaluejoin }; -// Only with Node -if (!WEB) { +if (typeof process !== "undefined") { // Only with Node const readlineSync = require('readline-sync'); readlineSync.setDefaultOptions({ prompt: 'lua_debug> ' @@ -656,9 +656,9 @@ const luaD_pcall = function(L, func, u, old_top, ef) { ** Similar to 'luaD_call', but does not allow yields during the call */ const luaD_callnoyield = function(L, off, nResults) { - L.nny++; - luaD_call(L, off, nResults); - L.nny--; + L.nny++; + luaD_call(L, off, nResults); + L.nny--; }; /* diff --git a/src/ldump.js b/src/ldump.js index 3ab0e47..8b9b1ff 100644 --- a/src/ldump.js +++ b/src/ldump.js @@ -164,18 +164,18 @@ const DumpFunction = function(f, psource, D) { }; const DumpHeader = function(D) { - DumpLiteral(defs.LUA_SIGNATURE, D); - DumpByte(LUAC_VERSION, D); - DumpByte(LUAC_FORMAT, D); - let cdata = LUAC_DATA.split('').map(e => e.charCodeAt(0)); - DumpBlock(cdata, cdata.length, D); - DumpByte(4, D); // intSize - DumpByte(4, D); // size_tSize - DumpByte(4, D); // instructionSize - DumpByte(4, D); // integerSize - DumpByte(8, D); // numberSize - DumpInteger(LUAC_INT, D); - DumpNumber(LUAC_NUM, D); + DumpLiteral(defs.LUA_SIGNATURE, D); + DumpByte(LUAC_VERSION, D); + DumpByte(LUAC_FORMAT, D); + let cdata = LUAC_DATA.split('').map(e => e.charCodeAt(0)); + DumpBlock(cdata, cdata.length, D); + DumpByte(4, D); // intSize + DumpByte(4, D); // size_tSize + DumpByte(4, D); // instructionSize + DumpByte(4, D); // integerSize + DumpByte(8, D); // numberSize + DumpInteger(LUAC_INT, D); + DumpNumber(LUAC_NUM, D); }; /* diff --git a/src/linit.js b/src/linit.js index 90ad978..97cbfc9 100644 --- a/src/linit.js +++ b/src/linit.js @@ -26,7 +26,7 @@ const luaL_openlibs = function(L) { "_G": lbaselib.luaopen_base }; - if (!WEB) loadedlibs[lualib.LUA_IOLIBNAME] = require('./liolib.js').luaopen_io; + if (typeof process !== "undefined") loadedlibs[lualib.LUA_IOLIBNAME] = require('./liolib.js').luaopen_io; /* "require" functions from 'loadedlibs' and set results to global table */ for (let lib in loadedlibs) { diff --git a/src/liolib.js b/src/liolib.js index a87309a..3241011 100644 --- a/src/liolib.js +++ b/src/liolib.js @@ -95,11 +95,11 @@ const g_iofile = function(L, f, mode) { }; const io_input = function(L) { - return g_iofile(L, IO_INPUT, "r"); + return g_iofile(L, IO_INPUT, "r"); }; const io_output = function(L) { - return g_iofile(L, IO_OUTPUT, "w"); + return g_iofile(L, IO_OUTPUT, "w"); }; const g_write = function(L, f, arg) { diff --git a/src/llex.js b/src/llex.js index cc3d0ef..9e27d02 100644 --- a/src/llex.js +++ b/src/llex.js @@ -415,7 +415,7 @@ const read_string = function(ls, del, seminfo) { case char['u']: utf8esc(ls); will = 'no_save'; break; case char['\n']: case char['\r']: inclinenumber(ls); c = char['\n']; will = 'only_save'; break; - case char['\\']: case char['\"']: case char['\'']: + case char['\\']: case char['"']: case char['\'']: c = ls.current; will = 'read_save'; break; case lzio.EOZ: will = 'no_save'; break; /* will raise an error next loop */ case char['z']: { /* zap following span of spaces */ diff --git a/src/lmathlib.js b/src/lmathlib.js index f2354ca..e056fd8 100644 --- a/src/lmathlib.js +++ b/src/lmathlib.js @@ -27,7 +27,7 @@ const math_random = function(L) { /* random integer in the interval [low, up] */ lauxlib.luaL_argcheck(L, low <= up, 1, lua.to_luastring("interval is empty", true)); lauxlib.luaL_argcheck(L, low >= 0 || up <= luaconf.LUA_MAXINTEGER + low, 1, - lua.to_luastring("interval too large", true)); + lua.to_luastring("interval too large", true)); r *= (up - low) + 1; lua.lua_pushinteger(L, Math.floor(r) + low); diff --git a/src/loadlib.js b/src/loadlib.js index dbd5c3c..cae377f 100644 --- a/src/loadlib.js +++ b/src/loadlib.js @@ -36,7 +36,7 @@ const AUXMARK = [1]; ** error string in the stack. */ let lsys_load; -if (WEB) { +if (typeof process === "undefined") { lsys_load = function(L, path, seeglb) { path = lua.to_uristring(path); let xhr = new XMLHttpRequest(); @@ -111,9 +111,7 @@ const noenv = function(L) { }; let readable; -// Only with Node -if (!WEB) { - +if (typeof process !== "undefined") { // Only with Node const fs = require('fs'); readable = function(filename) { @@ -189,7 +187,7 @@ const ll_loadlib = function(L) { }; let env; -if (WEB) { +if (typeof process === "undefined") { env = window; } else { env = process.env; @@ -304,7 +302,7 @@ const checkload = function(L, stat, filename) { return 2; /* return open function and file name */ } else return lauxlib.luaL_error(L, lua.to_luastring("error loading module '%s' from file '%s':\n\t%s"), - lua.lua_tostring(L, 1), filename, lua.lua_tostring(L, -1)); + lua.lua_tostring(L, 1), filename, lua.lua_tostring(L, -1)); }; const searcher_Lua = function(L) { diff --git a/src/lobject.js b/src/lobject.js index bc0909d..becec17 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -417,7 +417,7 @@ const lua_str2number = function(s) { return null; } /* parseFloat ignores trailing junk, validate with regex first */ - if (!/^[\t\v\f \n\r]*[\+\-]?([0-9]+\.?[0-9]*|\.[0-9]*)([eE][\+\-]?[0-9]+)?[\t\v\f \n\r]*$/.test(s)) + if (!/^[\t\v\f \n\r]*[+-]?([0-9]+\.?[0-9]*|\.[0-9]*)([eE][+-]?[0-9]+)?[\t\v\f \n\r]*$/.test(s)) return null; let flt = parseFloat(s); return !isNaN(flt) ? flt : null; @@ -539,23 +539,25 @@ const luaO_pushvfstring = function(L, fmt, argp) { let i = 0; let a = 0; let e; - while (1) { + for (;;) { e = fmt.indexOf(char['%'], i); if (e == -1) break; pushstr(L, fmt.slice(i, e)); switch(fmt[e+1]) { - case char['s']: + case char['s']: { let s = argp[a++]; if (s === null) s = defs.to_luastring("(null)", true); pushstr(L, s); break; - case char['c']: + } + case char['c']: { let buff = argp[a++]; if (ljstype.lisprint(buff)) pushstr(L, [buff]); else luaO_pushfstring(L, defs.to_luastring("<\\%d>", true), buff); break; + } case char['d']: case char['I']: ldo.luaD_inctop(L); @@ -567,7 +569,7 @@ const luaO_pushvfstring = function(L, fmt, argp) { L.stack[L.top-1].setfltvalue(argp[a++]); luaO_tostring(L, L.stack[L.top-1]); break; - case char['p']: + case char['p']: { let v = argp[a++]; if (v instanceof lstate.lua_State || v instanceof ltable.Table || @@ -598,15 +600,15 @@ const luaO_pushvfstring = function(L, fmt, argp) { pushstr(L, defs.to_luastring("<id NYI>")); } break; + } case char['U']: pushstr(L, defs.to_luastring(String.fromCodePoint(argp[a++]))); break; case char['%']: pushstr(L, [char['%']]); break; - default: { + default: ldebug.luaG_runerror(L, defs.to_luastring("invalid option '%%%c' to 'lua_pushfstring'"), fmt[e + 1]); - } } n += 2; i = e + 2; diff --git a/src/loslib.js b/src/loslib.js index 4b147cf..19dfd02 100644 --- a/src/loslib.js +++ b/src/loslib.js @@ -82,7 +82,7 @@ const checkoption = function(L, conv, i, buff) { }; /* maximum size for an individual 'strftime' item */ -const SIZETIMEFMT = 250; +// const SIZETIMEFMT = 250; const os_date = function(L) { @@ -157,7 +157,7 @@ const syslib = { "time": os_time }; -if (WEB) { +if (typeof process === "undefined") { syslib.clock = function(L) { lua.lua_pushnumber(L, performance.now()/1000); return 1; diff --git a/src/lparser.js b/src/lparser.js index ddd514e..d183d25 100644 --- a/src/lparser.js +++ b/src/lparser.js @@ -118,7 +118,7 @@ class FuncState { } } - /* description of active local variable */ +/* description of active local variable */ class Vardesc { constructor() { this.idx = NaN; /* variable index in stack */ @@ -214,7 +214,7 @@ const check_match = function(ls, what, who, where) { else llex.luaX_syntaxerror(ls, lobject.luaO_pushfstring(ls.L, defs.to_luastring("%s expected (to close %s at line %d)"), - llex.luaX_token2str(ls, what), llex.luaX_token2str(ls, who), where)); + llex.luaX_token2str(ls, what), llex.luaX_token2str(ls, who), where)); } }; @@ -351,7 +351,7 @@ const singlevar = function(ls, vr) { let varname = str_checkname(ls); let fs = ls.fs; singlevaraux(fs, varname, vr, 1); - if (vr.k === expkind.VVOID) { /* global name? */ + if (vr.k === expkind.VVOID) { /* is global name? */ let key = new expdesc(); singlevaraux(fs, ls.envn, vr, 1); /* get environment variable */ assert(vr.k !== expkind.VVOID); /* this one must exist */ @@ -504,8 +504,8 @@ const breaklabel = function(ls) { */ const undefgoto = function(ls, gt) { let msg = llex.isreserved(gt.name) - ? "<%s> at line %d not inside a loop" - : "no visible label '%s' for <goto> at line %d"; + ? "<%s> at line %d not inside a loop" + : "no visible label '%s' for <goto> at line %d"; msg = lobject.luaO_pushfstring(ls.L, defs.to_luastring(msg), gt.name.getstr(), gt.line); semerror(ls, msg); }; @@ -1166,8 +1166,8 @@ const checkrepeated = function(fs, ll, label) { for (let i = fs.bl.firstlabel; i < ll.n; i++) { if (eqstr(label, ll.arr[i].name)) { let msg = lobject.luaO_pushfstring(fs.ls.L, - defs.to_luastring("label '%s' already defined on line %d", true), - label.getstr(), ll.arr[i].line); + defs.to_luastring("label '%s' already defined on line %d", true), + label.getstr(), ll.arr[i].line); semerror(fs.ls, msg); } } @@ -1340,7 +1340,7 @@ const test_then_block = function(ls, escapelist) { lcode.luaK_goiffalse(ls.fs, v); /* will jump to label if condition is true */ enterblock(fs, bl, false); /* must enter block before 'goto' */ gotostat(ls, v.t); /* handle goto/break */ - while (testnext(ls, char[';'])) {} /* skip colons */ + while (testnext(ls, char[';'])); /* skip colons */ if (block_follow(ls, 0)) { /* 'goto' is the entire block? */ leaveblock(fs); return escapelist; /* and that is it */ diff --git a/src/lstrlib.js b/src/lstrlib.js index 80a5f55..cfd1c28 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -148,7 +148,7 @@ const lua_number2strx = function(L, fmt, x) { ** is maximum exponent + 1). (99+3+1 then rounded to 120 for "extra ** expenses", such as locale-dependent stuff) */ -const MAX_ITEM = 120;// TODO: + l_mathlim(MAX_10_EXP); +// const MAX_ITEM = 120;// TODO: + l_mathlim(MAX_10_EXP); /* valid flags in a format specification */ @@ -157,7 +157,7 @@ const FLAGS = ["-".charCodeAt(0), "+".charCodeAt(0), " ".charCodeAt(0), "#" /* ** maximum size of each format specification (such as "%-099.99d") */ -const MAX_FORMAT = 32; +// const MAX_FORMAT = 32; // TODO: locale ? and do it better const isalpha = e => ('a'.charCodeAt(0) <= e && e <= 'z'.charCodeAt(0)) || (e >= 'A'.charCodeAt(0) && e <= 'Z'.charCodeAt(0)); @@ -607,8 +607,8 @@ const str_pack = function(L) { case KOption.Kstring: { /* strings with length count */ let s = lauxlib.luaL_checkstring(L, arg); let len = s.length; - lauxlib.luaL_argcheck(L, size >= 4 /* sizeof(size_t) */ || - len < (1 << (size * NB)), + lauxlib.luaL_argcheck(L, + size >= 4 /* sizeof(size_t) */ || len < (1 << (size * NB)), arg, lua.to_luastring("string length does not fit in given size", true)); packint(b, len, h.islittle, size, 0); /* pack length */ b.push(...s); @@ -1331,7 +1331,7 @@ const add_value = function(ms, b, s, e, tr) { lua.lua_pushlstring(L, ms.src.slice(s, e), e - s); /* keep original text */ } else if (!lua.lua_isstring(L, -1)) lauxlib.luaL_error(L, lua.to_luastring("invalid replacement value (a %s)"), lauxlib.luaL_typename(L, -1)); - lauxlib.luaL_addvalue(b); /* add result to accumulator */ + lauxlib.luaL_addvalue(b); /* add result to accumulator */ }; const str_gsub = function(L) { diff --git a/src/ltable.js b/src/ltable.js index f7b1167..cf8b1da 100644 --- a/src/ltable.js +++ b/src/ltable.js @@ -24,58 +24,59 @@ const get_lightuserdata_hash = function(v) { const table_hash = function(L, key) { switch(key.type) { - case CT.LUA_TNIL: - return ldebug.luaG_runerror(L, defs.to_luastring("table index is nil", true)); - case CT.LUA_TNUMFLT: - if (isNaN(key.value)) - return ldebug.luaG_runerror(L, defs.to_luastring("table index is NaN", true)); - /* fall through */ - case CT.LUA_TNUMINT: /* takes advantage of floats and integers being same in JS */ - case CT.LUA_TBOOLEAN: - case CT.LUA_TTABLE: - case CT.LUA_TLCL: - case CT.LUA_TLCF: - case CT.LUA_TCCL: - case CT.LUA_TUSERDATA: - case CT.LUA_TTHREAD: - return key.value; - case CT.LUA_TSHRSTR: - case CT.LUA_TLNGSTR: - return lstring.luaS_hashlongstr(key.tsvalue()); - case CT.LUA_TLIGHTUSERDATA: - let v = key.value; - switch(typeof v) { - case "string": - /* possible conflict with LUA_TSTRING. - prefix this string with "*" so they don't clash */ - return "*" + v; - case "number": - /* possible conflict with LUA_TNUMBER. - turn into string and prefix with "#" to avoid clash with other strings */ - return "#" + v; - case "boolean": - /* possible conflict with LUA_TBOOLEAN. use strings ?true and ?false instead */ - return v?"?true":"?false"; - case "function": - /* possible conflict with LUA_TLCF. - indirect via a weakmap */ - return get_lightuserdata_hash(v); - case "object": - /* v could be a lua_State, CClosure, LClosure, Table or Userdata from this state as returned by lua_topointer */ - if ((v instanceof lstate.lua_State && v.l_G === L.l_G) || - v instanceof Table || - v instanceof lobject.Udata || - v instanceof lobject.LClosure || - v instanceof lobject.CClosure) { - /* indirect via a weakmap */ - return get_lightuserdata_hash(v); - } + case CT.LUA_TNIL: + return ldebug.luaG_runerror(L, defs.to_luastring("table index is nil", true)); + case CT.LUA_TNUMFLT: + if (isNaN(key.value)) + return ldebug.luaG_runerror(L, defs.to_luastring("table index is NaN", true)); /* fall through */ - default: - return v; + case CT.LUA_TNUMINT: /* takes advantage of floats and integers being same in JS */ + case CT.LUA_TBOOLEAN: + case CT.LUA_TTABLE: + case CT.LUA_TLCL: + case CT.LUA_TLCF: + case CT.LUA_TCCL: + case CT.LUA_TUSERDATA: + case CT.LUA_TTHREAD: + return key.value; + case CT.LUA_TSHRSTR: + case CT.LUA_TLNGSTR: + return lstring.luaS_hashlongstr(key.tsvalue()); + case CT.LUA_TLIGHTUSERDATA: { + let v = key.value; + switch(typeof v) { + case "string": + /* possible conflict with LUA_TSTRING. + prefix this string with "*" so they don't clash */ + return "*" + v; + case "number": + /* possible conflict with LUA_TNUMBER. + turn into string and prefix with "#" to avoid clash with other strings */ + return "#" + v; + case "boolean": + /* possible conflict with LUA_TBOOLEAN. use strings ?true and ?false instead */ + return v?"?true":"?false"; + case "function": + /* possible conflict with LUA_TLCF. + indirect via a weakmap */ + return get_lightuserdata_hash(v); + case "object": + /* v could be a lua_State, CClosure, LClosure, Table or Userdata from this state as returned by lua_topointer */ + if ((v instanceof lstate.lua_State && v.l_G === L.l_G) || + v instanceof Table || + v instanceof lobject.Udata || + v instanceof lobject.LClosure || + v instanceof lobject.CClosure) { + /* indirect via a weakmap */ + return get_lightuserdata_hash(v); + } + /* fall through */ + default: + return v; + } } - default: - throw new Error("unknown key type: " + key.type); + default: + throw new Error("unknown key type: " + key.type); } }; @@ -141,18 +141,18 @@ const luaT_trybinTM = function(L, p1, p2, res, event) { if (!luaT_callbinTM(L, p1, p2, res, event)) { switch (event) { case TMS.TM_CONCAT: - ldebug.luaG_concaterror(L, p1, p2); + return ldebug.luaG_concaterror(L, p1, p2); case TMS.TM_BAND: case TMS.TM_BOR: case TMS.TM_BXOR: case TMS.TM_SHL: case TMS.TM_SHR: case TMS.TM_BNOT: { let n1 = lvm.tonumber(p1); let n2 = lvm.tonumber(p2); if (n1 !== false && n2 !== false) - ldebug.luaG_tointerror(L, p1, p2); + return ldebug.luaG_tointerror(L, p1, p2); else - ldebug.luaG_opinterror(L, p1, p2, defs.to_luastring("perform bitwise operation on", true)); + return ldebug.luaG_opinterror(L, p1, p2, defs.to_luastring("perform bitwise operation on", true)); } default: - ldebug.luaG_opinterror(L, p1, p2, defs.to_luastring("perform arithmetic on", true)); + return ldebug.luaG_opinterror(L, p1, p2, defs.to_luastring("perform arithmetic on", true)); } } }; diff --git a/src/lualib.js b/src/lualib.js index 50ca433..4fbae44 100644 --- a/src/lualib.js +++ b/src/lualib.js @@ -14,7 +14,7 @@ const LUA_TABLIBNAME = "table"; module.exports.LUA_TABLIBNAME = LUA_TABLIBNAME; module.exports.luaopen_table = require("./ltablib.js").luaopen_table; -if (!WEB) { +if (typeof process !== "undefined") { const LUA_IOLIBNAME = "io"; module.exports.LUA_IOLIBNAME = LUA_IOLIBNAME; module.exports.luaopen_io = require("./liolib.js").luaopen_io; diff --git a/src/lundump.js b/src/lundump.js index b25a955..ff87903 100644 --- a/src/lundump.js +++ b/src/lundump.js @@ -145,24 +145,24 @@ class BytecodeParser { let t = this.readByte(); switch (t) { - case defs.CT.LUA_TNIL: - f.k.push(new lobject.TValue(defs.CT.LUA_TNIL, null)); - break; - case defs.CT.LUA_TBOOLEAN: - f.k.push(new lobject.TValue(defs.CT.LUA_TBOOLEAN, this.readByte() !== 0)); - break; - case defs.CT.LUA_TNUMFLT: - f.k.push(new lobject.TValue(defs.CT.LUA_TNUMFLT, this.readNumber())); - break; - case defs.CT.LUA_TNUMINT: - f.k.push(new lobject.TValue(defs.CT.LUA_TNUMINT, this.readInteger())); - break; - case defs.CT.LUA_TSHRSTR: - case defs.CT.LUA_TLNGSTR: - f.k.push(new lobject.TValue(defs.CT.LUA_TLNGSTR, this.readString())); - break; - default: - this.error(`unrecognized constant '${t}'`); + case defs.CT.LUA_TNIL: + f.k.push(new lobject.TValue(defs.CT.LUA_TNIL, null)); + break; + case defs.CT.LUA_TBOOLEAN: + f.k.push(new lobject.TValue(defs.CT.LUA_TBOOLEAN, this.readByte() !== 0)); + break; + case defs.CT.LUA_TNUMFLT: + f.k.push(new lobject.TValue(defs.CT.LUA_TNUMFLT, this.readNumber())); + break; + case defs.CT.LUA_TNUMINT: + f.k.push(new lobject.TValue(defs.CT.LUA_TNUMINT, this.readInteger())); + break; + case defs.CT.LUA_TSHRSTR: + case defs.CT.LUA_TLNGSTR: + f.k.push(new lobject.TValue(defs.CT.LUA_TLNGSTR, this.readString())); + break; + default: + this.error(`unrecognized constant '${t}'`); } } } @@ -78,16 +78,16 @@ const luaV_finishOp = function(L) { }; const RA = function(L, base, i) { - return base + i.A; + return base + i.A; }; const RB = function(L, base, i) { - return base + i.B; + return base + i.B; }; -const RC = function(L, base, i) { - return base + i.C; -}; +// const RC = function(L, base, i) { +// return base + i.C; +// }; const RKB = function(L, base, k, i) { return lopcodes.ISK(i.B) ? k[lopcodes.INDEXK(i.B)] : L.stack[base + i.B]; diff --git a/tests/defs.js b/tests/defs.js index 244e31b..8c0098a 100644 --- a/tests/defs.js +++ b/tests/defs.js @@ -1,90 +1,89 @@ const test = require('tape'); -global.WEB = false; const defs = require('../src/defs.js'); const unicode_tests = [ - { + { description: "Convert normal ascii string", - literal: "foo", - byte_array: ["f".charCodeAt(0), "o".charCodeAt(0), "o".charCodeAt(0)] + literal: "foo", + byte_array: ["f".charCodeAt(0), "o".charCodeAt(0), "o".charCodeAt(0)] }, - { + { description: "Convert ascii string containing null byte", - literal: "fo\0o", - byte_array: ["f".charCodeAt(0), "o".charCodeAt(0), 0, "o".charCodeAt(0)] + literal: "fo\0o", + byte_array: ["f".charCodeAt(0), "o".charCodeAt(0), 0, "o".charCodeAt(0)] }, - { + { description: "Convert string with BMP unicode chars", - literal: "Café", - byte_array: [67, 97, 102, 195, 169] + literal: "Café", + byte_array: [67, 97, 102, 195, 169] }, - { + { description: "Convert string with codepoint in PUA (U+E000 to U+F8FF)", - literal: "", - byte_array: [239, 163, 191] + literal: "", + byte_array: [239, 163, 191] }, - { + { description: "Convert string with surrogate pair", - literal: "❤️🍾", - byte_array: [226, 157, 164, 239, 184, 143, 240, 159, 141, 190] + literal: "❤️🍾", + byte_array: [226, 157, 164, 239, 184, 143, 240, 159, 141, 190] }, - { + { description: "Convert string with broken surrogate pair", - literal: "\uD800a", - byte_array: [237, 160, 128, 97] + literal: "\uD800a", + byte_array: [237, 160, 128, 97] }, - { + { description: "Convert string with broken surrogate pair at end of string", - literal: "\uD823", - byte_array: [237, 160, 163] + literal: "\uD823", + byte_array: [237, 160, 163] } ]; test('to_luastring', function (t) { - t.plan(unicode_tests.length); + t.plan(unicode_tests.length); - unicode_tests.forEach(function(v) { - t.deepEqual(defs.to_luastring(v.literal), v.byte_array, v.description); - }); + unicode_tests.forEach(function(v) { + t.deepEqual(defs.to_luastring(v.literal), v.byte_array, v.description); + }); }); test('to_jsstring', function (t) { - t.plan(unicode_tests.length); + t.plan(unicode_tests.length); - unicode_tests.forEach(function(v) { - t.deepEqual(defs.to_jsstring(v.byte_array), v.literal, v.description); - }); + unicode_tests.forEach(function(v) { + t.deepEqual(defs.to_jsstring(v.byte_array), v.literal, v.description); + }); }); test('to_jsstring fails on invalid unicode', function (t) { - t.plan(7); + t.plan(7); - t.throws(function() { - defs.to_jsstring([165]); - }, "non-utf8 char"); + t.throws(function() { + defs.to_jsstring([165]); + }, "non-utf8 char"); - t.throws(function() { - defs.to_jsstring([208, 60]); - }, "invalid continuation byte"); + t.throws(function() { + defs.to_jsstring([208, 60]); + }, "invalid continuation byte"); - t.throws(function() { - defs.to_jsstring([225, 60, 145]); - }, "invalid continuation byte"); + t.throws(function() { + defs.to_jsstring([225, 60, 145]); + }, "invalid continuation byte"); - t.throws(function() { - defs.to_jsstring([225, 145, 60]); - }, "invalid continuation byte"); + t.throws(function() { + defs.to_jsstring([225, 145, 60]); + }, "invalid continuation byte"); - t.throws(function() { - defs.to_jsstring([242, 60, 145, 145]); - }, "invalid continuation byte"); + t.throws(function() { + defs.to_jsstring([242, 60, 145, 145]); + }, "invalid continuation byte"); - t.throws(function() { - defs.to_jsstring([242, 145, 60, 145]); - }, "invalid continuation byte"); + t.throws(function() { + defs.to_jsstring([242, 145, 60, 145]); + }, "invalid continuation byte"); - t.throws(function() { - defs.to_jsstring([242, 145, 145, 60]); - }, "invalid continuation byte"); + t.throws(function() { + defs.to_jsstring([242, 145, 145, 60]); + }, "invalid continuation byte"); }); diff --git a/tests/lapi.js b/tests/lapi.js index b764064..5a6785d 100644 --- a/tests/lapi.js +++ b/tests/lapi.js @@ -10,7 +10,7 @@ const lua = require('../src/lua.js'); test('luaL_newstate, lua_pushnil, luaL_typename', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { @@ -31,7 +31,7 @@ test('luaL_newstate, lua_pushnil, luaL_typename', function (t) { test('lua_pushnumber', function (t) { let L; - + t.plan(3); t.doesNotThrow(function () { @@ -58,7 +58,7 @@ test('lua_pushnumber', function (t) { test('lua_pushinteger', function (t) { let L; - + t.plan(3); t.doesNotThrow(function () { @@ -85,7 +85,7 @@ test('lua_pushinteger', function (t) { test('lua_pushliteral', function (t) { let L; - + t.plan(3); t.doesNotThrow(function () { @@ -112,7 +112,7 @@ test('lua_pushliteral', function (t) { test('lua_pushboolean', function (t) { let L; - + t.plan(3); t.doesNotThrow(function () { @@ -139,7 +139,7 @@ test('lua_pushboolean', function (t) { test('lua_pushvalue', function (t) { let L; - + t.plan(5); t.doesNotThrow(function () { @@ -180,7 +180,7 @@ test('lua_pushvalue', function (t) { test('lua_pushjsclosure', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { @@ -206,7 +206,7 @@ test('lua_pushjsclosure', function (t) { test('lua_pushjsfunction', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { @@ -231,7 +231,7 @@ test('lua_pushjsfunction', function (t) { test('lua_call (calling a light JS function)', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { @@ -259,7 +259,7 @@ test('lua_call (calling a light JS function)', function (t) { test('lua_call (calling a JS closure)', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { @@ -288,7 +288,7 @@ test('lua_call (calling a JS closure)', function (t) { test('lua_pcall (calling a light JS function)', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { @@ -316,7 +316,7 @@ test('lua_pcall (calling a light JS function)', function (t) { test('lua_pcall that breaks', function (t) { let L; - + t.plan(1); t.doesNotThrow(function () { @@ -339,7 +339,7 @@ test('lua_pcall that breaks', function (t) { test('lua_pop', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { @@ -383,10 +383,10 @@ test('lua_load with no chunkname', function (t) { test('lua_load and lua_call it', function (t) { let luaCode = ` - local a = "JS > Lua > JS \o/" + local a = "JS > Lua > JS \\o/" return a `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -403,7 +403,7 @@ test('lua_load and lua_call it', function (t) { t.strictEqual( lua.lua_tojsstring(L, -1), - "JS > Lua > JS \o/", + "JS > Lua > JS \\o/", "Correct element(s) on the stack" ); }); @@ -413,7 +413,7 @@ test('lua script reads js upvalues', function (t) { let luaCode = ` return js .. " world" `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -439,7 +439,7 @@ test('lua script reads js upvalues', function (t) { test('lua_createtable', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { @@ -458,7 +458,7 @@ test('lua_createtable', function (t) { test('lua_newtable', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { @@ -477,7 +477,7 @@ test('lua_newtable', function (t) { test('lua_settable, lua_gettable', function (t) { let L; - + t.plan(2); t.doesNotThrow(function () { diff --git a/tests/lauxlib.js b/tests/lauxlib.js index 4e37296..d484edb 100644 --- a/tests/lauxlib.js +++ b/tests/lauxlib.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../src/lua.js'); const lauxlib = require("../src/lauxlib.js"); diff --git a/tests/lbaselib.js b/tests/lbaselib.js index fcd8356..6558c1f 100644 --- a/tests/lbaselib.js +++ b/tests/lbaselib.js @@ -11,7 +11,7 @@ test('print', function (t) { let luaCode = ` print("hello", "world", 123) `, L; - + t.plan(1); t.doesNotThrow(function () { @@ -43,7 +43,7 @@ test('setmetatable, getmetatable', function (t) { return t[1], getmetatable(t) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -86,7 +86,7 @@ test('rawequal', function (t) { return rawequal(t1, t2), t1 == t2 `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -130,7 +130,7 @@ test('rawset, rawget', function (t) { return rawget(t, "yo"), t["yo"], rawget(t, "yoyo"), t["yoyo"] `, L; - + t.plan(5); t.doesNotThrow(function () { @@ -175,7 +175,7 @@ test('type', function (t) { let luaCode = ` return type(1), type(true), type("hello"), type({}), type(nil) `, L; - + t.plan(6); t.doesNotThrow(function () { @@ -226,7 +226,7 @@ test('error', function (t) { let luaCode = ` error("you fucked up") `, L; - + t.plan(1); t.throws(function () { @@ -247,7 +247,7 @@ test('error, protected', function (t) { let luaCode = ` error("you fucked up") `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -277,7 +277,7 @@ test('pcall', function (t) { return pcall(willFail) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -311,7 +311,7 @@ test('xpcall', function (t) { return xpcall(willFail, msgh) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -349,7 +349,7 @@ test('ipairs', function (t) { return sum `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -376,7 +376,7 @@ test('select', function (t) { let luaCode = ` return {select('#', 1, 2, 3)}, {select(2, 1, 2, 3)}, {select(-2, 1, 2, 3)} `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -469,7 +469,7 @@ test('assert', function (t) { let luaCode = ` assert(1 < 0, "this doesn't makes sense") `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -495,7 +495,7 @@ test('rawlen', function (t) { let luaCode = ` return rawlen({1, 2, 3}), rawlen('hello') `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -540,7 +540,7 @@ test('next', function (t) { return total `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -579,7 +579,7 @@ test('pairs', function (t) { return total `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -627,7 +627,7 @@ test('pairs with __pairs', function (t) { return total `, L; - + t.plan(2); t.doesNotThrow(function () { diff --git a/tests/lcorolib.js b/tests/lcorolib.js index 4faf13b..e1868b2 100644 --- a/tests/lcorolib.js +++ b/tests/lcorolib.js @@ -20,7 +20,7 @@ test('coroutine.create, coroutine.yield, coroutine.resume', function (t) { return pow `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -61,7 +61,7 @@ test('coroutine.status', function (t) { return s1, s2 `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -100,7 +100,7 @@ test('coroutine.isyieldable', function (t) { return yieldable, coroutine.isyieldable() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -139,7 +139,7 @@ test('coroutine.running', function (t) { return running, ismain `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -178,7 +178,7 @@ test('coroutine.wrap', function (t) { return pow `, L; - + t.plan(2); t.doesNotThrow(function () { diff --git a/tests/ldblib.js b/tests/ldblib.js index 7f39c09..209e60e 100644 --- a/tests/ldblib.js +++ b/tests/ldblib.js @@ -23,7 +23,7 @@ test('debug.sethook', function (t) { return result `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -47,7 +47,6 @@ test('debug.sethook', function (t) { "return count line count line count line call count line return count line count line call count line return count line count line call count line return count line ", "Correct element(s) on the stack" ); - }); @@ -67,7 +66,7 @@ test('debug.gethook', function (t) { return debug.gethook() `, L; - + t.plan(5); t.doesNotThrow(function () { @@ -103,7 +102,6 @@ test('debug.gethook', function (t) { 1, "Correct element(s) on the stack" ); - }); @@ -127,7 +125,7 @@ test('debug.getlocal', function (t) { return result `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -151,7 +149,6 @@ test('debug.getlocal', function (t) { "alocal alocalanother anotherinfunction infunctionanotherin anotherin", "Correct element(s) on the stack" ); - }); test('debug.setlocal', function (t) { @@ -175,7 +172,7 @@ test('debug.setlocal', function (t) { return alocal, another, a, b `, L; - + t.plan(6); t.doesNotThrow(function () { @@ -217,7 +214,6 @@ test('debug.setlocal', function (t) { 4, "Correct element(s) on the stack" ); - }); test('debug.upvalueid', function (t) { @@ -230,7 +226,7 @@ test('debug.upvalueid', function (t) { return debug.upvalueid(l, 1) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -253,7 +249,6 @@ test('debug.upvalueid', function (t) { lua.lua_touserdata(L, -1), "Correct element(s) on the stack" ); - }); @@ -274,7 +269,7 @@ test('debug.upvaluejoin', function (t) { return l1() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -298,7 +293,6 @@ test('debug.upvaluejoin', function (t) { "upvalue2", "Correct element(s) on the stack" ); - }); @@ -319,7 +313,7 @@ test('debug.traceback (with a global)', function (t) { return trace `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -340,8 +334,7 @@ test('debug.traceback (with a global)', function (t) { }, "Lua program ran without error"); t.strictEqual( - lua.lua_tojsstring(L, -1), -`stack traceback: + lua.lua_tojsstring(L, -1), `stack traceback: \t[string "traceback-test"]:9: in function 'rec' \t[string "traceback-test"]:7: in function 'rec' \t[string "traceback-test"]:7: in function 'rec' @@ -356,7 +349,6 @@ test('debug.traceback (with a global)', function (t) { \t[string "traceback-test"]:13: in main chunk`, "Correct element(s) on the stack" ); - }); @@ -378,7 +370,7 @@ test('debug.traceback (with a upvalue)', function (t) { return trace `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -399,8 +391,7 @@ test('debug.traceback (with a upvalue)', function (t) { }, "Lua program ran without error"); t.strictEqual( - lua.lua_tojsstring(L, -1), -`stack traceback: + lua.lua_tojsstring(L, -1), `stack traceback: \t[string "traceback-test"]:10: in upvalue 'rec' \t[string "traceback-test"]:8: in upvalue 'rec' \t[string "traceback-test"]:8: in upvalue 'rec' @@ -415,7 +406,6 @@ test('debug.traceback (with a upvalue)', function (t) { \t[string "traceback-test"]:14: in main chunk`, "Correct element(s) on the stack" ); - }); test('debug.getinfo', function (t) { @@ -432,7 +422,7 @@ test('debug.getinfo', function (t) { return d1.short_src, d1.nups, d1.what, d1.nparams, d2.short_src, d2.nups, d2.what, d2.nparams `, L; - + t.plan(10); t.doesNotThrow(function () { @@ -499,5 +489,4 @@ test('debug.getinfo', function (t) { 0, "Correct element(s) on the stack" ); - }); diff --git a/tests/ldebug.js b/tests/ldebug.js index 8809bde..857345e 100644 --- a/tests/ldebug.js +++ b/tests/ldebug.js @@ -11,7 +11,7 @@ test('luaG_typeerror', function (t) { local a = true return #a `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -66,7 +66,7 @@ test('luaG_typeerror', function (t) { local a = true return a.yo `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -145,7 +145,7 @@ test('luaG_opinterror', function (t) { let luaCode = ` return {} + 'hello' `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -171,7 +171,7 @@ test('luaG_tointerror', function (t) { let luaCode = ` return 123.5 & 12 `, L; - + t.plan(2); t.doesNotThrow(function () { diff --git a/tests/lexparse.js b/tests/lexparse.js index ecb386f..e7ba0c5 100644 --- a/tests/lexparse.js +++ b/tests/lexparse.js @@ -2,9 +2,6 @@ const test = require('tape'); -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'); @@ -17,7 +14,7 @@ test('LOADK, RETURN', function (t) { local a = "hello world" return a `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -57,7 +54,7 @@ test('MOVE', function (t) { local b = a return b `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -97,7 +94,7 @@ test('Binary op', function (t) { local b = 10 return a + b, a - b, a * b, a / b, a % b, a^b, a // b, a & b, a | b, a ~ b, a << b, a >> b `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -137,7 +134,7 @@ test('Unary op, LOADBOOL', function (t) { local b = false return -a, not b, ~a `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -175,7 +172,7 @@ test('NEWTABLE', function (t) { local a = {} return a `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -217,7 +214,7 @@ test('CALL', function (t) { return c `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -263,7 +260,7 @@ test('Multiple return', function (t) { return c, d, e `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -304,7 +301,7 @@ test('TAILCALL', function (t) { return f(1,2) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -345,7 +342,7 @@ test('VARARG', function (t) { return f(1,2,3) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -384,7 +381,7 @@ test('LE, JMP', function (t) { return a >= b `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -423,7 +420,7 @@ test('LT', function (t) { return a > b `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -462,7 +459,7 @@ test('EQ', function (t) { return a == b `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -502,7 +499,7 @@ test('TESTSET (and)', function (t) { return a and b `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -542,7 +539,7 @@ test('TESTSET (or)', function (t) { return a or b `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -586,7 +583,7 @@ test('TEST (false)', function (t) { return "goodbye" `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -629,7 +626,7 @@ test('FORPREP, FORLOOP (int)', function (t) { return total `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -672,7 +669,7 @@ test('FORPREP, FORLOOP (float)', function (t) { return total `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -714,7 +711,7 @@ test('SETTABLE, GETTABLE', function (t) { return t `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -765,7 +762,7 @@ test('SETUPVAL, GETUPVAL', function (t) { return f() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -807,7 +804,7 @@ test('SETTABUP, GETTABUP', function (t) { return t `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -857,7 +854,7 @@ test('SELF', function (t) { return t:get() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -896,7 +893,7 @@ test('SETLIST', function (t) { return t `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -939,7 +936,7 @@ test('Variable SETLIST', function (t) { return t `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -977,7 +974,7 @@ test('Long SETLIST', function (t) { return t `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -1032,7 +1029,7 @@ test('TFORCALL, TFORLOOP', function (t) { return r `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -1073,7 +1070,7 @@ test('LEN', function (t) { return #t, #t2, #s `, L; - + t.plan(5); t.doesNotThrow(function () { @@ -1122,7 +1119,7 @@ test('CONCAT', function (t) { let luaCode = ` return "hello " .. 2 .. " you" `, L; - + t.plan(3); t.doesNotThrow(function () { diff --git a/tests/lmathlib.js b/tests/lmathlib.js index b227af0..5c307a5 100644 --- a/tests/lmathlib.js +++ b/tests/lmathlib.js @@ -12,7 +12,7 @@ test('math.abs, math.sin, math.cos, math.tan, math.asin, math.acos, math.atan', return math.abs(-10), math.abs(-10.5), math.cos(10), math.tan(10), math.asin(1), math.acos(0.5), math.atan(10) `, L; - + t.plan(8); t.doesNotThrow(function () { @@ -75,7 +75,7 @@ test('math.ceil, math.floor', function (t) { let luaCode = ` return math.ceil(10.5), math.floor(10.5) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -101,7 +101,6 @@ test('math.ceil, math.floor', function (t) { 10, "Correct element(s) on the stack" ); - }); @@ -109,7 +108,7 @@ test('math.deg, math.rad', function (t) { let luaCode = ` return math.deg(10), math.rad(10) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -135,7 +134,6 @@ test('math.deg, math.rad', function (t) { 0.17453292519943295, "Correct element(s) on the stack" ); - }); @@ -143,7 +141,7 @@ test('math.log', function (t) { let luaCode = ` return math.log(10), math.log(10, 2), math.log(10, 10) `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -175,7 +173,6 @@ test('math.log', function (t) { 1, "Correct element(s) on the stack" ); - }); @@ -183,7 +180,7 @@ test('math.exp', function (t) { let luaCode = ` return math.exp(10) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -203,7 +200,6 @@ test('math.exp', function (t) { 22026.465794806718, "Correct element(s) on the stack" ); - }); @@ -211,7 +207,7 @@ test('math.min, math.max', function (t) { let luaCode = ` return math.max(10, 5, 23), math.min(10, 5, 23) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -237,7 +233,6 @@ test('math.min, math.max', function (t) { 5, "Correct element(s) on the stack" ); - }); @@ -245,7 +240,7 @@ test('math.random', function (t) { let luaCode = ` return math.random(), math.random(10, 15) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -269,7 +264,6 @@ test('math.random', function (t) { 10 <= lua.lua_tonumber(L, -1) <= 15, "Correct element(s) on the stack" ); - }); @@ -277,7 +271,7 @@ test('math.sqrt', function (t) { let luaCode = ` return math.sqrt(10) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -297,7 +291,6 @@ test('math.sqrt', function (t) { 3.1622776601683795, "Correct element(s) on the stack" ); - }); @@ -305,7 +298,7 @@ test('math.tointeger', function (t) { let luaCode = ` return math.tointeger('10') `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -325,7 +318,6 @@ test('math.tointeger', function (t) { 10, "Correct element(s) on the stack" ); - }); @@ -333,7 +325,7 @@ test('math.type', function (t) { let luaCode = ` return math.type(10), math.type(10.5), math.type('hello') `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -365,7 +357,6 @@ test('math.type', function (t) { null, "Correct element(s) on the stack" ); - }); @@ -373,7 +364,7 @@ test('math.ult', function (t) { let luaCode = ` return math.tointeger('10') `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -393,7 +384,6 @@ test('math.ult', function (t) { true, "Correct element(s) on the stack" ); - }); @@ -401,7 +391,7 @@ test('math.fmod', function (t) { let luaCode = ` return math.fmod(2,5) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -421,7 +411,6 @@ test('math.fmod', function (t) { 2, "Correct element(s) on the stack" ); - }); @@ -429,7 +418,7 @@ test('math.modf', function (t) { let luaCode = ` return math.modf(3.4, 0.6) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -455,5 +444,4 @@ test('math.modf', function (t) { 0.3999999999999999, "Correct element(s) on the stack" ); - }); diff --git a/tests/load.js b/tests/load.js index a385959..49756a5 100644 --- a/tests/load.js +++ b/tests/load.js @@ -15,7 +15,7 @@ test('luaL_loadstring', function (t) { local a = "hello world" return a `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -39,7 +39,6 @@ test('luaL_loadstring', function (t) { "hello world", "Correct element(s) on the stack" ); - }); @@ -48,7 +47,7 @@ test('load', function (t) { local f = load("return 'js running lua running lua'") return f() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -72,7 +71,6 @@ test('load', function (t) { "js running lua running lua", "Correct element(s) on the stack" ); - }); @@ -81,7 +79,7 @@ test('luaL_loadbuffer', function (t) { local a = "hello world" return a `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -107,7 +105,6 @@ test('luaL_loadbuffer', function (t) { "hello world", "Correct element(s) on the stack" ); - }); // TODO: test stdin @@ -116,7 +113,7 @@ test('loadfile', function (t) { local f = loadfile("tests/loadfile-test.lua") return f() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -140,7 +137,6 @@ test('loadfile', function (t) { "hello world", "Correct element(s) on the stack" ); - }); @@ -149,7 +145,7 @@ test('loadfile (binary)', function (t) { local f = loadfile("tests/loadfile-test.bc") return f() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -173,7 +169,6 @@ test('loadfile (binary)', function (t) { "hello world", "Correct element(s) on the stack" ); - }); @@ -181,7 +176,7 @@ test('dofile', function (t) { let luaCode = ` return dofile("tests/loadfile-test.lua") `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -205,5 +200,4 @@ test('dofile', function (t) { "hello world", "Correct element(s) on the stack" ); - }); diff --git a/tests/loadlib.js b/tests/loadlib.js index 5854519..c4c98ea 100644 --- a/tests/loadlib.js +++ b/tests/loadlib.js @@ -11,7 +11,7 @@ test('require an existing module', function (t) { let luaCode = ` return require('os') `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -34,7 +34,6 @@ test('require an existing module', function (t) { lua.lua_istable(L, -1), "Correct element(s) on the stack" ); - }); @@ -42,7 +41,7 @@ test('require a file', function (t) { let luaCode = ` return require('tests/module-hello')() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -66,7 +65,6 @@ test('require a file', function (t) { "hello from module", "Correct element(s) on the stack" ); - }); @@ -74,7 +72,7 @@ test('package.loadlib', function (t) { let luaCode = ` return package.loadlib('./tests/lib-hello.js.mod', 'hello')() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -98,7 +96,6 @@ test('package.loadlib', function (t) { "hello from js lib", "Correct element(s) on the stack" ); - }); @@ -106,7 +103,7 @@ test('package.searchpath', function (t) { let luaCode = ` return package.searchpath('module-hello', './?.lua;./tests/?.lua') `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -130,5 +127,4 @@ test('package.searchpath', function (t) { "./tests/module-hello.lua", "Correct element(s) on the stack" ); - }); diff --git a/tests/loslib.js b/tests/loslib.js index 2470359..83d6c81 100644 --- a/tests/loslib.js +++ b/tests/loslib.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../src/lua.js'); const lauxlib = require('../src/lauxlib.js'); const lualib = require('../src/lualib.js'); @@ -13,7 +11,7 @@ test('os.time', function (t) { let luaCode = ` return os.time() `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -36,7 +34,6 @@ test('os.time', function (t) { lua.lua_isinteger(L, -1), "Correct element(s) on the stack" ); - }); @@ -48,7 +45,7 @@ test('os.time (with format)', function (t) { year = 2015 }) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -72,7 +69,6 @@ test('os.time (with format)', function (t) { new Date(2015, 1, 8, 12, 0, 0, 0).getTime() / 1000, "Correct element(s) on the stack" ); - }); @@ -82,7 +78,7 @@ test('os.difftime', function (t) { local t2 = os.time() return os.difftime(t2, t1) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -105,7 +101,6 @@ test('os.difftime', function (t) { lua.lua_isnumber(L, -1), "Correct element(s) on the stack" ); - }); @@ -117,7 +112,7 @@ test('os.date', function (t) { year = 2015 })) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -141,7 +136,6 @@ test('os.date', function (t) { "2015-02-08", "Correct element(s) on the stack" ); - }); @@ -149,7 +143,7 @@ test('os.getenv', function (t) { let luaCode = ` return os.getenv('PATH') `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -172,5 +166,4 @@ test('os.getenv', function (t) { lua.lua_isstring(L, -1), "Correct element(s) on the stack" ); - }); diff --git a/tests/lstrlib.js b/tests/lstrlib.js index 817ebcb..a55fca1 100644 --- a/tests/lstrlib.js +++ b/tests/lstrlib.js @@ -12,7 +12,7 @@ test('string.len', function (t) { local a = "world" return string.len("hello"), a:len() `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -50,7 +50,7 @@ test('string.char', function (t) { let luaCode = ` return string.char(104, 101, 108, 108, 111) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -81,7 +81,7 @@ test('string.upper, string.lower', function (t) { let luaCode = ` return string.upper("hello"), string.lower("HELLO") `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -118,7 +118,7 @@ test('string.rep', function (t) { let luaCode = ` return string.rep("hello", 3, ", ") `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -149,7 +149,7 @@ test('string.reverse', function (t) { let luaCode = ` return string.reverse("olleh") `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -180,7 +180,7 @@ test('string.byte', function (t) { let luaCode = ` return string.byte("hello", 2, 4) `, L; - + t.plan(5); t.doesNotThrow(function () { @@ -223,7 +223,7 @@ test('string.format', function (t) { let luaCode = ` return string.format("%%%d %010d", 10, 23) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -254,7 +254,7 @@ test('string.format', function (t) { let luaCode = ` return string.format("%07X", 0xFFFFFFF) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -285,7 +285,7 @@ test('string.format', function (t) { let luaCode = ` return string.format("%q", 'a string with "quotes" and \\n new line') `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -326,7 +326,7 @@ test('string.sub', function (t) { string.sub("123456789",-4), -- "6789" string.sub("123456789",-6, -4) -- "456" `, L; - + t.plan(13); t.doesNotThrow(function () { @@ -359,7 +359,7 @@ test('string.sub', function (t) { t.strictEqual( lua.lua_tojsstring(L, -9), - "", + "", "Correct element(s) on the stack" ); @@ -371,7 +371,7 @@ test('string.sub', function (t) { t.strictEqual( lua.lua_tojsstring(L, -7), - "", + "", "Correct element(s) on the stack" ); @@ -389,7 +389,7 @@ test('string.sub', function (t) { t.strictEqual( lua.lua_tojsstring(L, -4), - "", + "", "Correct element(s) on the stack" ); @@ -425,8 +425,8 @@ test('string.dump', function (t) { end return string.dump(todump) - `, L, bytes = []; - + `, L; + t.plan(3); t.doesNotThrow(function () { @@ -465,7 +465,7 @@ test('string.pack/unpack/packsize', function (t) { local us1, un, us2 = string.unpack("c5jc3", packed) return string.packsize("c5jc3"), s1 == us1 and n == un and s2 == us2 `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -501,7 +501,7 @@ test('string.find without pattern', function (t) { let luaCode = ` return string.find("hello to you", " to ") `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -538,7 +538,7 @@ test('string.match', function (t) { let luaCode = ` return string.match("foo: 123 bar: 456", "(%a+):%s*(%d+)") `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -575,7 +575,7 @@ test('string.find', function (t) { let luaCode = ` return string.find("foo: 123 bar: 456", "(%a+):%s*(%d+)") `, L; - + t.plan(6); t.doesNotThrow(function () { @@ -631,7 +631,7 @@ test('string.gmatch', function (t) { return table.unpack(t) `, L; - + t.plan(6); t.doesNotThrow(function () { @@ -680,7 +680,7 @@ test('string.gsub', function (t) { let luaCode = ` return string.gsub("hello world", "(%w+)", "%1 %1") `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -717,7 +717,7 @@ test('string.gsub (number)', function (t) { let luaCode = ` return string.gsub("hello world", "%w+", "%0 %0", 1) `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -754,7 +754,7 @@ test('string.gsub (pattern)', function (t) { let luaCode = ` return string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1") `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -793,7 +793,7 @@ test('string.gsub (function)', function (t) { return load(s)() end) `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -832,7 +832,7 @@ test('string.gsub (table)', function (t) { local t = {name="lua", version="5.3"} return string.gsub("$name-$version.tar.gz", "%$(%w+)", t) `, L; - + t.plan(4); t.doesNotThrow(function () { diff --git a/tests/ltablib.js b/tests/ltablib.js index e2e8825..2adf1fe 100644 --- a/tests/ltablib.js +++ b/tests/ltablib.js @@ -22,7 +22,7 @@ test('table.concat', function (t) { let luaCode = ` return table.concat({1, 2, 3, 4, 5, 6, 7}, ",", 3, 5) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -49,7 +49,7 @@ test('table.pack', function (t) { let luaCode = ` return table.pack(1, 2, 3) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -78,7 +78,7 @@ test('table.unpack', function (t) { let luaCode = ` return table.unpack({1, 2, 3, 4, 5}, 2, 4) `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -120,7 +120,7 @@ test('table.insert', function (t) { table.insert(t, 2, 2) return t `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -152,7 +152,7 @@ test('table.remove', function (t) { table.remove(t, 3) return t `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -183,7 +183,7 @@ test('table.move', function (t) { local t2 = {1, 2, nil, nil, nil, 6} return table.move(t1, 1, #t1, 3, t2) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -214,7 +214,7 @@ test('table.sort (<)', function (t) { table.sort(t) return t `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -245,7 +245,7 @@ test('table.sort with cmp function', function (t) { end) return t `, L; - + t.plan(2); t.doesNotThrow(function () { diff --git a/tests/ltm.js b/tests/ltm.js index 86fa52c..0d9bc1a 100644 --- a/tests/ltm.js +++ b/tests/ltm.js @@ -12,7 +12,7 @@ test('__index, __newindex: with actual table', function (t) { local t = {yo=1} return t.yo, t.lo `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -42,7 +42,7 @@ test('__newindex: with non table', function (t) { local t = "a string" t.yo = "hello" `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -73,7 +73,7 @@ test('__index function in metatable', function (t) { return t.yo `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -113,7 +113,7 @@ test('__newindex function in metatable', function (t) { return t.yo `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -151,7 +151,7 @@ test('__index table in metatable', function (t) { return t.yo `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -192,7 +192,7 @@ test('__newindex table in metatable', function (t) { return t.yo, mmt.yo `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -244,7 +244,7 @@ test('__index table with own metatable', function (t) { return t.yo `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -295,7 +295,7 @@ test('__newindex table with own metatable', function (t) { return t.yo, up `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -394,7 +394,7 @@ test('binary __xxx functions in metatable', function (t) { t << 1, t >> 1 `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -444,7 +444,7 @@ test('__eq', function (t) { return t == {} `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -480,7 +480,7 @@ test('__lt', function (t) { return t < {} `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -516,7 +516,7 @@ test('__le', function (t) { return t <= {} `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -552,7 +552,7 @@ test('__le that uses __lt', function (t) { return {} <= t `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -592,7 +592,7 @@ test('__unm, __bnot', function (t) { return -t, ~t `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -635,7 +635,7 @@ test('__len', function (t) { return #t `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -672,7 +672,7 @@ test('__concat', function (t) { return t .. " world" `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -709,7 +709,7 @@ test('__call', function (t) { return t("world","wow") `, L; - + t.plan(3); t.doesNotThrow(function () { diff --git a/tests/lua.js b/tests/lua.js index 487f748..82df6ff 100644 --- a/tests/lua.js +++ b/tests/lua.js @@ -9,85 +9,80 @@ const lapi = require('../src/lapi.js'); // TODO: remove -if (false) { - test('locals.lua', function (t) { - let luaCode = ` - _soft = true - require = function(lib) return _G[lib] end -- NYI - return dofile("tests/lua-tests/locals.lua") - `, L; - - t.plan(2); +test.skip('locals.lua', function (t) { + let luaCode = ` + _soft = true + require = function(lib) return _G[lib] end -- NYI + return dofile("tests/lua-tests/locals.lua") + `, L; - t.doesNotThrow(function () { + t.plan(2); - L = lauxlib.luaL_newstate(); + t.doesNotThrow(function () { - lualib.luaL_openlibs(L); + L = lauxlib.luaL_newstate(); - lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + lualib.luaL_openlibs(L); - }, "Lua program loaded without error"); + lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); - t.doesNotThrow(function () { + }, "Lua program loaded without error"); - lapi.lua_call(L, 0, -1); + t.doesNotThrow(function () { - }, "Lua program ran without error"); + lapi.lua_call(L, 0, -1); - }); + }, "Lua program ran without error"); +}); - test('constructs.lua', function (t) { - let luaCode = ` - _soft = true - require = function(lib) return _G[lib] end -- NYI - return dofile("tests/lua-tests/constructs.lua") - `, L; - - t.plan(2); +test.skip('constructs.lua', function (t) { + let luaCode = ` + _soft = true + require = function(lib) return _G[lib] end -- NYI + return dofile("tests/lua-tests/constructs.lua") + `, L; - t.doesNotThrow(function () { + t.plan(2); - L = lauxlib.luaL_newstate(); + t.doesNotThrow(function () { - lualib.luaL_openlibs(L); + L = lauxlib.luaL_newstate(); - lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + lualib.luaL_openlibs(L); - }, "Lua program loaded without error"); + lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); - t.doesNotThrow(function () { + }, "Lua program loaded without error"); - lapi.lua_call(L, 0, -1); + t.doesNotThrow(function () { - }, "Lua program ran without error"); + lapi.lua_call(L, 0, -1); - }); + }, "Lua program ran without error"); +}); - test('strings.lua', function (t) { - let luaCode = ` - return dofile("tests/lua-tests/strings.lua") - `, L; - - t.plan(2); +test.skip('strings.lua', function (t) { + let luaCode = ` + return dofile("tests/lua-tests/strings.lua") + `, L; - t.doesNotThrow(function () { + t.plan(2); - L = lauxlib.luaL_newstate(); + t.doesNotThrow(function () { - lualib.luaL_openlibs(L); + L = lauxlib.luaL_newstate(); - lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + lualib.luaL_openlibs(L); - }, "Lua program loaded without error"); + lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); - t.doesNotThrow(function () { + }, "Lua program loaded without error"); - lapi.lua_call(L, 0, -1); + t.doesNotThrow(function () { - }, "Lua program ran without error"); + lapi.lua_call(L, 0, -1); - }); -} + }, "Lua program ran without error"); +}); diff --git a/tests/lutf8lib.js b/tests/lutf8lib.js index cff7472..ae40d3c 100644 --- a/tests/lutf8lib.js +++ b/tests/lutf8lib.js @@ -10,7 +10,7 @@ test('utf8.offset', function (t) { let luaCode = ` return utf8.offset("( ͡° ͜ʖ ͡° )", 5) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -34,7 +34,6 @@ test('utf8.offset', function (t) { 7, "Correct element(s) on the stack" ); - }); @@ -42,7 +41,7 @@ test('utf8.codepoint', function (t) { let luaCode = ` return utf8.codepoint("( ͡° ͜ʖ ͡° )", 5, 8) `, L; - + t.plan(5); t.doesNotThrow(function () { @@ -78,7 +77,6 @@ test('utf8.codepoint', function (t) { 860, "Correct element(s) on the stack" ); - }); @@ -86,7 +84,7 @@ test('utf8.char', function (t) { let luaCode = ` return utf8.char(40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 32, 41) `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -110,7 +108,6 @@ test('utf8.char', function (t) { "( ͡° ͜ʖ ͡° )", "Correct element(s) on the stack" ); - }); @@ -118,7 +115,7 @@ test('utf8.len', function (t) { let luaCode = ` return utf8.len("( ͡° ͜ʖ ͡° )") `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -142,7 +139,6 @@ test('utf8.len', function (t) { 12, "Correct element(s) on the stack" ); - }); @@ -155,7 +151,7 @@ test('utf8.codes', function (t) { end return results `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -179,5 +175,4 @@ test('utf8.codes', function (t) { "[1,40] [2,32] [3,865] [5,176] [7,32] [8,860] [10,662] [12,32] [13,865] [15,176] [17,32] [18,41] ", "Correct element(s) on the stack" ); - }); diff --git a/tests/lvm.js b/tests/lvm.js index 226583b..209329e 100644 --- a/tests/lvm.js +++ b/tests/lvm.js @@ -11,7 +11,7 @@ test('LOADK, RETURN', function (t) { local a = "hello world" return a `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -33,7 +33,7 @@ test('MOVE', function (t) { local b = a return b `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -54,7 +54,7 @@ test('Binary op', function (t) { local b = 10 return a + b, a - b, a * b, a / b, a % b, a^b, a // b, a & b, a | b, a ~ b, a << b, a >> b `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -76,7 +76,7 @@ test('Unary op, LOADBOOL', function (t) { local b = false return -a, not b, ~a `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -97,7 +97,7 @@ test('NEWTABLE', function (t) { local a = {} return a `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -122,7 +122,7 @@ test('CALL', function (t) { return c `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -152,7 +152,7 @@ test('Multiple return', function (t) { return c, d, e `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -176,7 +176,7 @@ test('TAILCALL', function (t) { return f(1,2) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -200,7 +200,7 @@ test('VARARG', function (t) { return f(1,2,3) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -222,7 +222,7 @@ test('LE, JMP', function (t) { return a >= b `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -244,7 +244,7 @@ test('LT', function (t) { return a > b `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -266,7 +266,7 @@ test('EQ', function (t) { return a == b `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -289,7 +289,7 @@ test('TESTSET (and)', function (t) { return a and b `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -312,7 +312,7 @@ test('TESTSET (or)', function (t) { return a or b `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -339,7 +339,7 @@ test('TEST (true)', function (t) { return "goodbye" `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -366,7 +366,7 @@ test('TEST (false)', function (t) { return "goodbye" `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -392,7 +392,7 @@ test('FORPREP, FORLOOP (int)', function (t) { return total `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -418,7 +418,7 @@ test('FORPREP, FORLOOP (float)', function (t) { return total `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -443,7 +443,7 @@ test('SETTABLE, GETTABLE', function (t) { return t `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -477,7 +477,7 @@ test('SETUPVAL, GETUPVAL', function (t) { return f() `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -502,7 +502,7 @@ test('SETTABUP, GETTABUP', function (t) { return t `, L; - + t.plan(3); t.doesNotThrow(function () { @@ -535,7 +535,7 @@ test('SELF', function (t) { return t:get() `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -557,7 +557,7 @@ test('SETLIST', function (t) { return t `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -583,7 +583,7 @@ test('Variable SETLIST', function (t) { return t `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -605,7 +605,7 @@ test('Long SETLIST', function (t) { return t `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -627,7 +627,7 @@ test('Long SETLIST', function (t) { // // return t // `, L; -// +// // t.plan(1); // // @@ -667,7 +667,7 @@ test('TFORCALL, TFORLOOP', function (t) { return r `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -691,7 +691,7 @@ test('LEN', function (t) { return #t, #t2, #s `, L; - + t.plan(4); t.doesNotThrow(function () { @@ -723,7 +723,7 @@ test('CONCAT', function (t) { let luaCode = ` return "hello " .. 2 .. " you" `, L; - + t.plan(2); t.doesNotThrow(function () { diff --git a/tests/manual-tests/debug-cli.js b/tests/manual-tests/debug-cli.js index 5fba8e5..3feb981 100755 --- a/tests/manual-tests/debug-cli.js +++ b/tests/manual-tests/debug-cli.js @@ -1,8 +1,6 @@ #!/usr/bin/env node "use strict"; -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/api.js b/tests/test-suite/api.js index 8b59e9c..b5f45c3 100644 --- a/tests/test-suite/api.js +++ b/tests/test-suite/api.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/attrib.js b/tests/test-suite/attrib.js index d6c3803..fcd3271 100644 --- a/tests/test-suite/attrib.js +++ b/tests/test-suite/attrib.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/bitwise.js b/tests/test-suite/bitwise.js index 3969bb0..df57f15 100644 --- a/tests/test-suite/bitwise.js +++ b/tests/test-suite/bitwise.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/calls.js b/tests/test-suite/calls.js index 451f6c0..fdd5eac 100644 --- a/tests/test-suite/calls.js +++ b/tests/test-suite/calls.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/closure.js b/tests/test-suite/closure.js index 8e9e4b1..464a5b5 100644 --- a/tests/test-suite/closure.js +++ b/tests/test-suite/closure.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/code.js b/tests/test-suite/code.js index 4438cd2..26ca021 100644 --- a/tests/test-suite/code.js +++ b/tests/test-suite/code.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/constructs.js b/tests/test-suite/constructs.js index 20a1210..89bcce7 100644 --- a/tests/test-suite/constructs.js +++ b/tests/test-suite/constructs.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); @@ -21,7 +19,7 @@ test('[test-suite] constructs: testing semicolons', function (t) { ; do ; a = 3; assert(a == 3) end; ; `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -47,7 +45,7 @@ test('[test-suite] constructs: invalid operations should not raise errors when n let luaCode = ` if false then a = 3 // 0; a = 0 % 0 end `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -112,7 +110,7 @@ test('[test-suite] constructs: testing priorities', function (t) { assert(1234567890 == tonumber('1234567890') and 1234567890+1 == 1234567891) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -298,7 +296,7 @@ test('[test-suite] constructs: silly loops', function (t) { a,b = F(1)~=nil; assert(a == true and b == nil); a,b = F(nil)==nil; assert(a == true and b == nil) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -319,94 +317,92 @@ test('[test-suite] constructs: silly loops', function (t) { }); -if (false) { - test('[test-suite] constructs: huge loops, upvalue', function (t) { - let luaCode = ` - -- sometimes will be 0, sometimes will not... - _ENV.GLOB1 = math.floor(os.time()) % 2 - - -- basic expressions with their respective values - local basiccases = { - {"nil", nil}, - {"false", false}, - {"true", true}, - {"10", 10}, - {"(0==_ENV.GLOB1)", 0 == _ENV.GLOB1}, - } - - print('testing short-circuit optimizations (' .. _ENV.GLOB1 .. ')') - - - -- operators with their respective values - local binops = { - {" and ", function (a,b) if not a then return a else return b end end}, - {" or ", function (a,b) if a then return a else return b end end}, - } - - local cases = {} - - -- creates all combinations of '(cases[i] op cases[n-i])' plus - -- 'not(cases[i] op cases[n-i])' (syntax + value) - local function createcases (n) - local res = {} - for i = 1, n - 1 do - for _, v1 in ipairs(cases[i]) do - for _, v2 in ipairs(cases[n - i]) do - for _, op in ipairs(binops) do - local t = { - "(" .. v1[1] .. op[1] .. v2[1] .. ")", - op[2](v1[2], v2[2]) - } - res[#res + 1] = t - res[#res + 1] = {"not" .. t[1], not t[2]} - end - end +test.skip('[test-suite] constructs: huge loops, upvalue', function (t) { + let luaCode = ` + -- sometimes will be 0, sometimes will not... + _ENV.GLOB1 = math.floor(os.time()) % 2 + + -- basic expressions with their respective values + local basiccases = { + {"nil", nil}, + {"false", false}, + {"true", true}, + {"10", 10}, + {"(0==_ENV.GLOB1)", 0 == _ENV.GLOB1}, + } + + print('testing short-circuit optimizations (' .. _ENV.GLOB1 .. ')') + + + -- operators with their respective values + local binops = { + {" and ", function (a,b) if not a then return a else return b end end}, + {" or ", function (a,b) if a then return a else return b end end}, + } + + local cases = {} + + -- creates all combinations of '(cases[i] op cases[n-i])' plus + -- 'not(cases[i] op cases[n-i])' (syntax + value) + local function createcases (n) + local res = {} + for i = 1, n - 1 do + for _, v1 in ipairs(cases[i]) do + for _, v2 in ipairs(cases[n - i]) do + for _, op in ipairs(binops) do + local t = { + "(" .. v1[1] .. op[1] .. v2[1] .. ")", + op[2](v1[2], v2[2]) + } + res[#res + 1] = t + res[#res + 1] = {"not" .. t[1], not t[2]} end end - return res end + end + return res + end - -- do not do too many combinations for soft tests - local level = _soft and 3 or 4 + -- do not do too many combinations for soft tests + local level = _soft and 3 or 4 - cases[1] = basiccases - for i = 2, level do cases[i] = createcases(i) end + cases[1] = basiccases + for i = 2, level do cases[i] = createcases(i) end - local prog = [[if %s then IX = true end; return %s]] + local prog = [[if %s then IX = true end; return %s]] - local i = 0 - for n = 1, level do - for _, v in pairs(cases[n]) do - local s = v[1] - local p = load(string.format(prog, s, s), "") - IX = false - assert(p() == v[2] and IX == not not v[2]) - i = i + 1 - if i % 60000 == 0 then print('+') end - end - end - `, L; - - t.plan(2); + local i = 0 + for n = 1, level do + for _, v in pairs(cases[n]) do + local s = v[1] + local p = load(string.format(prog, s, s), "") + IX = false + assert(p() == v[2] and IX == not not v[2]) + i = i + 1 + if i % 60000 == 0 then print('+') end + end + end + `, L; - t.doesNotThrow(function () { + t.plan(2); + + t.doesNotThrow(function () { - L = lauxlib.luaL_newstate(); + L = lauxlib.luaL_newstate(); - lualib.luaL_openlibs(L); + lualib.luaL_openlibs(L); - lauxlib.luaL_loadstring(L, lua.to_luastring(checkload + luaCode)); + lauxlib.luaL_loadstring(L, lua.to_luastring(checkload + luaCode)); - }, "Lua program loaded without error"); + }, "Lua program loaded without error"); - t.doesNotThrow(function () { + t.doesNotThrow(function () { - lua.lua_call(L, 0, -1); + lua.lua_call(L, 0, -1); - }, "Lua program ran without error"); + }, "Lua program ran without error"); - }); -} +}); test("[test-suite] constructs: testing some syntax errors (chosen through 'gcov')", function (t) { @@ -423,7 +419,7 @@ test("[test-suite] constructs: testing some syntax errors (chosen through 'gcov' checkload(s, "too long") end `, L; - + t.plan(2); t.doesNotThrow(function () { diff --git a/tests/test-suite/coroutine.js b/tests/test-suite/coroutine.js index 82f10a3..b85f0de 100644 --- a/tests/test-suite/coroutine.js +++ b/tests/test-suite/coroutine.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/db.js b/tests/test-suite/db.js index dcb57da..a2e3ce6 100644 --- a/tests/test-suite/db.js +++ b/tests/test-suite/db.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); @@ -517,7 +515,7 @@ test("[test-suite] db: tests for manipulating non-registered locals (C and Lua t function g(a,b) return (a+1) + f() end assert(g(0,0) == 30) - + debug.sethook(nil); assert(debug.gethook() == nil) @@ -567,7 +565,7 @@ test("[test-suite] db: testing access to function arguments", function (t) { dostring("XX = 12") -- test dostring inside hooks -- testing errors inside hooks assert(not pcall(load("a='joao'+1"))) - debug.sethook(function (e, l) + debug.sethook(function (e, l) assert(debug.getinfo(2, "l").currentline == l) local f,m,c = debug.gethook() assert(e == "line") @@ -692,7 +690,7 @@ test("[test-suite] db: testing upvalue access", function (t) { assert(debug.setupvalue(foo1, 1, "xuxu") == "b") assert(({debug.getupvalue(foo2, 3)})[2] == "xuxu") -- upvalues of C functions are allways "called" "" (the empty string) - assert(debug.getupvalue(string.gmatch("x", "x"), 1) == "") + assert(debug.getupvalue(string.gmatch("x", "x"), 1) == "") `, L; t.plan(2); @@ -1032,7 +1030,7 @@ test("[test-suite] db: testing debugging of coroutines", function (t) { let b = lua.to_luastring(luaCode); if (lauxlib.luaL_loadbuffer(L, b, b.length, lua.to_luastring("@db.lua")) !== lua.LUA_OK) - throw Error(lua.lua_tojsstring(L, -1)); + throw Error(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -1306,7 +1304,7 @@ test("[test-suite] db: testing traceback sizes", function (t) { let b = lua.to_luastring(luaCode); if (lauxlib.luaL_loadbuffer(L, b, b.length, lua.to_luastring("@db.lua")) !== lua.LUA_OK) - throw Error(lua.lua_tojsstring(L, -1)); + throw Error(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -1391,7 +1389,7 @@ test("[test-suite] db: tests for 'source' in binary dumps", function (t) { do local prog = [[ return function (x) - return function (y) + return function (y) return x + y end end @@ -1406,7 +1404,7 @@ test("[test-suite] db: tests for 'source' in binary dumps", function (t) { local h = g(3) assert(h(5) == 8) assert(debug.getinfo(f).source == name and -- all functions have 'source' - debug.getinfo(g).source == name and + debug.getinfo(g).source == name and debug.getinfo(h).source == name) -- again, without debug info local c = string.dump(p, true) @@ -1416,7 +1414,7 @@ test("[test-suite] db: tests for 'source' in binary dumps", function (t) { local h = g(30) assert(h(50) == 80) assert(debug.getinfo(f).source == '=?' and -- no function has 'source' - debug.getinfo(g).source == '=?' and + debug.getinfo(g).source == '=?' and debug.getinfo(h).source == '=?') end `, L; diff --git a/tests/test-suite/errors.js b/tests/test-suite/errors.js index 5980724..a6bc351 100644 --- a/tests/test-suite/errors.js +++ b/tests/test-suite/errors.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/events.js b/tests/test-suite/events.js index 0f94f36..9a15e93 100644 --- a/tests/test-suite/events.js +++ b/tests/test-suite/events.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/goto.js b/tests/test-suite/goto.js index c07541e..5acf633 100644 --- a/tests/test-suite/goto.js +++ b/tests/test-suite/goto.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/literals.js b/tests/test-suite/literals.js index d18d557..0078cf8 100644 --- a/tests/test-suite/literals.js +++ b/tests/test-suite/literals.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/locals.js b/tests/test-suite/locals.js index 3815f5d..cc82e38 100644 --- a/tests/test-suite/locals.js +++ b/tests/test-suite/locals.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/ltests.js b/tests/test-suite/ltests.js index 2f48287..8d89102 100644 --- a/tests/test-suite/ltests.js +++ b/tests/test-suite/ltests.js @@ -1,7 +1,5 @@ "use strict"; -global.WEB = false; - const assert = require("assert"); const lua = require('../../src/lua.js'); @@ -60,7 +58,7 @@ const getstring = function(L, buff, pc) { pc.offset++; } else { while (pc.script[pc.offset] !== 0 && pc.offset < pc.script.length && delimits.indexOf(pc.script[pc.offset]) < 0) - buff[i++] = pc.script[pc.offset++]; + buff[i++] = pc.script[pc.offset++]; } buff.length = i; return buff; @@ -109,379 +107,378 @@ const runJS = function(L, L1, pc) { let inst = lua.to_jsstring(getstring(L, buff, pc)); if (inst.length === 0) return 0; switch (inst) { - case "absindex": { - lua.lua_pushnumber(L1, lua.lua_absindex(L1, getindex(L, L1, pc))); - break; - } - case "append": { - let t = getindex(L, L1, pc); - let i = lua.lua_rawlen(L1, t); - lua.lua_rawseti(L1, t, i + 1); - break; - } - case "arith": { - let op; - skip(pc); - op = ops.indexOf(pc.script[pc.offset++]); - lua.lua_arith(L1, op); - break; - } - case "call": { - let narg = getnum(L, L1, pc); - let nres = getnum(L, L1, pc); - lua.lua_call(L1, narg, nres); - break; - } - case "callk": { - let narg = getnum(L, L1, pc); - let nres = getnum(L, L1, pc); - let i = getindex(L, L1, pc); - lua.lua_callk(L1, narg, nres, i, Cfunck); - break; - } - case "checkstack": { - let sz = getnum(L, L1, pc); - let msg = getstring(L, buff, pc); - if (msg.length === 0) - msg = null; /* to test 'luaL_checkstack' with no message */ - lauxlib.luaL_checkstack(L1, sz, msg); - break; - } - case "compare": { - let opt = getstring(L, buff, pc); /* EQ, LT, or LE */ - let op = (opt[0] === 'E'.charCodeAt(0)) ? lua.LUA_OPEQ - : (opt[1] === 'T'.charCodeAt(0)) ? lua.LUA_OPLT : lua.LUA_OPLE; - let a = getindex(L, L1, pc); - let b = getindex(L, L1, pc); - lua.lua_pushboolean(L1, lua.lua_compare(L1, a, b, op)); - break; - } - case "concat": { - lua.lua_concat(L1, getnum(L, L1, pc)); - break; - } - case "copy": { - let f = getindex(L, L1, pc); - lua.lua_copy(L1, f, getindex(L, L1, pc)); - break; - } - case "func2num": { - let func = lua.lua_tocfunction(L1, getindex(L, L1, pc)); - if (func === null) func = 0; - else if (func.id) func = func.id; - lua.lua_pushnumber(L1, func); - break; - } - case "getfield": { - let t = getindex(L, L1, pc); - lua.lua_getfield(L1, t, getstring(L, buff, pc)); - break; - } - case "getglobal": { - lua.lua_getglobal(L1, getstring(L, buff, pc)); - break; - } - case "getmetatable": { - if (lua.lua_getmetatable(L1, getindex(L, L1, pc)) === 0) + case "absindex": { + lua.lua_pushnumber(L1, lua.lua_absindex(L1, getindex(L, L1, pc))); + break; + } + case "append": { + let t = getindex(L, L1, pc); + let i = lua.lua_rawlen(L1, t); + lua.lua_rawseti(L1, t, i + 1); + break; + } + case "arith": { + let op; + skip(pc); + op = ops.indexOf(pc.script[pc.offset++]); + lua.lua_arith(L1, op); + break; + } + case "call": { + let narg = getnum(L, L1, pc); + let nres = getnum(L, L1, pc); + lua.lua_call(L1, narg, nres); + break; + } + case "callk": { + let narg = getnum(L, L1, pc); + let nres = getnum(L, L1, pc); + let i = getindex(L, L1, pc); + lua.lua_callk(L1, narg, nres, i, Cfunck); + break; + } + case "checkstack": { + let sz = getnum(L, L1, pc); + let msg = getstring(L, buff, pc); + if (msg.length === 0) + msg = null; /* to test 'luaL_checkstack' with no message */ + lauxlib.luaL_checkstack(L1, sz, msg); + break; + } + case "compare": { + let opt = getstring(L, buff, pc); /* EQ, LT, or LE */ + let op = (opt[0] === 'E'.charCodeAt(0)) + ? lua.LUA_OPEQ + : (opt[1] === 'T'.charCodeAt(0)) ? lua.LUA_OPLT : lua.LUA_OPLE; + let a = getindex(L, L1, pc); + let b = getindex(L, L1, pc); + lua.lua_pushboolean(L1, lua.lua_compare(L1, a, b, op)); + break; + } + case "concat": { + lua.lua_concat(L1, getnum(L, L1, pc)); + break; + } + case "copy": { + let f = getindex(L, L1, pc); + lua.lua_copy(L1, f, getindex(L, L1, pc)); + break; + } + case "func2num": { + let func = lua.lua_tocfunction(L1, getindex(L, L1, pc)); + if (func === null) func = 0; + else if (func.id) func = func.id; + lua.lua_pushnumber(L1, func); + break; + } + case "getfield": { + let t = getindex(L, L1, pc); + lua.lua_getfield(L1, t, getstring(L, buff, pc)); + break; + } + case "getglobal": { + lua.lua_getglobal(L1, getstring(L, buff, pc)); + break; + } + case "getmetatable": { + if (lua.lua_getmetatable(L1, getindex(L, L1, pc)) === 0) + lua.lua_pushnil(L1); + break; + } + case "gettable": { + lua.lua_gettable(L1, getindex(L, L1, pc)); + break; + } + case "gettop": { + lua.lua_pushinteger(L1, lua.lua_gettop(L1)); + break; + } + case "gsub": { + let a = getnum(L, L1, pc); + let b = getnum(L, L1, pc); + let c = getnum(L, L1, pc); + lauxlib.luaL_gsub(L1, lua.lua_tostring(L1, a), lua.lua_tostring(L1, b), lua.lua_tostring(L1, c)); + break; + } + case "insert": { + lua.lua_insert(L1, getnum(L, L1, pc)); + break; + } + case "iscfunction": { + lua.lua_pushboolean(L1, lua.lua_iscfunction(L1, getindex(L, L1, pc))); + break; + } + case "isfunction": { + lua.lua_pushboolean(L1, lua.lua_isfunction(L1, getindex(L, L1, pc))); + break; + } + case "isnil": { + lua.lua_pushboolean(L1, lua.lua_isnil(L1, getindex(L, L1, pc))); + break; + } + case "isnull": { + lua.lua_pushboolean(L1, lua.lua_isnone(L1, getindex(L, L1, pc))); + break; + } + case "isnumber": { + lua.lua_pushboolean(L1, lua.lua_isnumber(L1, getindex(L, L1, pc))); + break; + } + case "isstring": { + lua.lua_pushboolean(L1, lua.lua_isstring(L1, getindex(L, L1, pc))); + break; + } + case "istable": { + lua.lua_pushboolean(L1, lua.lua_istable(L1, getindex(L, L1, pc))); + break; + } + case "isudataval": { + lua.lua_pushboolean(L1, lua.lua_islightuserdata(L1, getindex(L, L1, pc))); + break; + } + case "isuserdata": { + lua.lua_pushboolean(L1, lua.lua_isuserdata(L1, getindex(L, L1, pc))); + break; + } + case "len": { + lua.lua_len(L1, getindex(L, L1, pc)); + break; + } + case "Llen": { + lua.lua_pushinteger(L1, lauxlib.luaL_len(L1, getindex(L, L1, pc))); + break; + } + case "loadfile": { + lauxlib.luaL_loadfile(L1, lauxlib.luaL_checkstring(L1, getnum(L, L1, pc))); + break; + } + case "loadstring": { + let s = lauxlib.luaL_checkstring(L1, getnum(L, L1, pc)); + lauxlib.luaL_loadstring(L1, s); + break; + } + case "newmetatable": { + lua.lua_pushboolean(L1, lauxlib.luaL_newmetatable(L1, getstring(L, buff, pc))); + break; + } + case "newtable": { + lua.lua_newtable(L1); + break; + } + case "newthread": { + lua.lua_newthread(L1); + break; + } + case "newuserdata": { + lua.lua_newuserdata(L1, getnum(L, L1, pc)); + break; + } + case "next": { + lua.lua_next(L1, -2); + break; + } + case "objsize": { + lua.lua_pushinteger(L1, lua.lua_rawlen(L1, getindex(L, L1, pc))); + break; + } + case "pcall": { + let narg = getnum(L, L1, pc); + let nres = getnum(L, L1, pc); + status = lua.lua_pcall(L1, narg, nres, getnum(L, L1, pc)); + break; + } + case "pcallk": { + let narg = getnum(L, L1, pc); + let nres = getnum(L, L1, pc); + let i = getindex(L, L1, pc); + status = lua.lua_pcallk(L1, narg, nres, 0, i, Cfunck); + break; + } + case "pop": { + lua.lua_pop(L1, getnum(L, L1, pc)); + break; + } + case "print": { + let n = getnum(L, L1, pc); + if (n !== 0) { + console.log(`${lauxlib.luaL_tojsstring(L1, n, null)}\n`); + lua.lua_pop(L1, 1); + } + else printstack(L1); + break; + } + case "pushbool": { + lua.lua_pushboolean(L1, getnum(L, L1, pc)); + break; + } + case "pushcclosure": { + lua.lua_pushcclosure(L1, testJS, getnum(L, L1, pc)); + break; + } + case "pushint": { + lua.lua_pushinteger(L1, getnum(L, L1, pc)); + break; + } + case "pushnil": { lua.lua_pushnil(L1); - break; - } - case "gettable": { - lua.lua_gettable(L1, getindex(L, L1, pc)); - break; - } - case "gettop": { - lua.lua_pushinteger(L1, lua.lua_gettop(L1)); - break; - } - case "gsub": { - let a = getnum(L, L1, pc); - let b = getnum(L, L1, pc); - let c = getnum(L, L1, pc); - lauxlib.luaL_gsub(L1, lua.lua_tostring(L1, a), lua.lua_tostring(L1, b), lua.lua_tostring(L1, c)); - break; - } - case "insert": { - lua.lua_insert(L1, getnum(L, L1, pc)); - break; - } - case "iscfunction": { - lua.lua_pushboolean(L1, lua.lua_iscfunction(L1, getindex(L, L1, pc))); - break; - } - case "isfunction": { - lua.lua_pushboolean(L1, lua.lua_isfunction(L1, getindex(L, L1, pc))); - break; - } - case "isnil": { - lua.lua_pushboolean(L1, lua.lua_isnil(L1, getindex(L, L1, pc))); - break; - } - case "isnull": { - lua.lua_pushboolean(L1, lua.lua_isnone(L1, getindex(L, L1, pc))); - break; - } - case "isnumber": { - lua.lua_pushboolean(L1, lua.lua_isnumber(L1, getindex(L, L1, pc))); - break; - } - case "isstring": { - lua.lua_pushboolean(L1, lua.lua_isstring(L1, getindex(L, L1, pc))); - break; - } - case "istable": { - lua.lua_pushboolean(L1, lua.lua_istable(L1, getindex(L, L1, pc))); - break; - } - case "isudataval": { - lua.lua_pushboolean(L1, lua.lua_islightuserdata(L1, getindex(L, L1, pc))); - break; - } - case "isuserdata": { - lua.lua_pushboolean(L1, lua.lua_isuserdata(L1, getindex(L, L1, pc))); - break; - } - case "len": { - lua.lua_len(L1, getindex(L, L1, pc)); - break; - } - case "Llen": { - lua.lua_pushinteger(L1, lauxlib.luaL_len(L1, getindex(L, L1, pc))); - break; - } - case "loadfile": { - lauxlib.luaL_loadfile(L1, lauxlib.luaL_checkstring(L1, getnum(L, L1, pc))); - break; - } - case "loadstring": { - let s = lauxlib.luaL_checkstring(L1, getnum(L, L1, pc)); - lauxlib.luaL_loadstring(L1, s); - break; - } - case "newmetatable": { - lua.lua_pushboolean(L1, lauxlib.luaL_newmetatable(L1, getstring(L, buff, pc))); - break; - } - case "newtable": { - lua.lua_newtable(L1); - break; - } - case "newthread": { - lua.lua_newthread(L1); - break; - } - case "newuserdata": { - lua.lua_newuserdata(L1, getnum(L, L1, pc)); - break; - } - case "next": { - lua.lua_next(L1, -2); - break; - } - case "objsize": { - lua.lua_pushinteger(L1, lua.lua_rawlen(L1, getindex(L, L1, pc))); - break; - } - case "pcall": { - let narg = getnum(L, L1, pc); - let nres = getnum(L, L1, pc); - status = lua.lua_pcall(L1, narg, nres, getnum(L, L1, pc)); - break; - } - case "pcallk": { - let narg = getnum(L, L1, pc); - let nres = getnum(L, L1, pc); - let i = getindex(L, L1, pc); - status = lua.lua_pcallk(L1, narg, nres, 0, i, Cfunck); - break; - } - case "pop": { - lua.lua_pop(L1, getnum(L, L1, pc)); - break; - } - case "print": { - let n = getnum(L, L1, pc); - if (n !== 0) { - console.log(`${lauxlib.luaL_tojsstring(L1, n, null)}\n`); - lua.lua_pop(L1, 1); + break; } - else printstack(L1); - break; - } - case "pushbool": { - lua.lua_pushboolean(L1, getnum(L, L1, pc)); - break; - } - case "pushcclosure": { - lua.lua_pushcclosure(L1, testJS, getnum(L, L1, pc)); - break; - } - case "pushint": { - lua.lua_pushinteger(L1, getnum(L, L1, pc)); - break; - } - case "pushnil": { - lua.lua_pushnil(L1); - break; - } - case "pushnum": { - lua.lua_pushnumber(L1, getnum(L, L1, pc)); - break; - } - case "pushstatus": { - pushcode(L1, status); - break; - } - case "pushstring": { - lua.lua_pushstring(L1, getstring(L, buff, pc)); - break; - } - case "pushupvalueindex": { - lua.lua_pushinteger(L1, lua.lua_upvalueindex(getnum(L, L1, pc))); - break; - } - case "pushvalue": { - lua.lua_pushvalue(L1, getindex(L, L1, pc)); - break; - } - case "rawgeti": { - let t = getindex(L, L1, pc); - lua.lua_rawgeti(L1, t, getnum(L, L1, pc)); - break; - } - case "rawgetp": { - let t = getindex(L, L1, pc); - lua.lua_rawgetp(L1, t, getnum(L, L1, pc)); - break; - } - case "rawsetp": { - let t = getindex(L, L1, pc); - lua.lua_rawsetp(L1, t, getnum(L, L1, pc)); - break; - } - case "remove": { - lua.lua_remove(L1, getnum(L, L1, pc)); - break; - } - case "replace": { - lua.lua_replace(L1, getindex(L, L1, pc)); - break; - } - case "resume": { - let i = getindex(L, L1, pc); - status = lua.lua_resume(lua.lua_tothread(L1, i), L, getnum(L, L1, pc)); - break; - } - case "return": { - let n = getnum(L, L1, pc); - if (L1 != L) { - let i; - for (i = 0; i < n; i++) - lua.lua_pushstring(L, lua.lua_tostring(L1, -(n - i))); - } - return n; - } - case "rotate": { - let i = getindex(L, L1, pc); - lua.lua_rotate(L1, i, getnum(L, L1, pc)); - break; - } - case "setfield": { - let t = getindex(L, L1, pc); - lua.lua_setfield(L1, t, getstring(L, buff, pc)); - break; - } - case "setglobal": { - lua.lua_setglobal(L1, getstring(L, buff, pc)); - break; - } - case "sethook": { - let mask = getnum(L, L1, pc); - let count = getnum(L, L1, pc); - sethookaux(L1, mask, count, getstring(L, buff, pc)); - break; - } - case "setmetatable": { - lua.lua_setmetatable(L1, getindex(L, L1, pc)); - break; - } - case "settable": { - lua.lua_settable(L1, getindex(L, L1, pc)); - break; - } - case "settop": { - lua.lua_settop(L1, getnum(L, L1, pc)); - break; - } - case "testudata": { - let i = getindex(L, L1, pc); - lua.lua_pushboolean(L1, lauxlib.luaL_testudata(L1, i, getstring(L, buff, pc)) !== null); - break; - } - case "error": { - lua.lua_error(L1); - break; - } - case "throw": { - throw new Error(); - break; - } - case "tobool": { - lua.lua_pushboolean(L1, lua.lua_toboolean(L1, getindex(L, L1, pc))); - break; - } - case "tocfunction": { - lua.lua_pushcfunction(L1, lua.lua_tocfunction(L1, getindex(L, L1, pc))); - break; - } - case "tointeger": { - lua.lua_pushinteger(L1, lua.lua_tointeger(L1, getindex(L, L1, pc))); - break; - } - case "tonumber": { - lua.lua_pushnumber(L1, lua.lua_tonumber(L1, getindex(L, L1, pc))); - break; - } - case "topointer": { - let p = lua.lua_topointer(L1, getindex(L, L1, pc)); - if (p === null) p = 0; - else if (p.id) p = p.id; - lua.lua_pushnumber(L1, p); /* in ltests.c, p is casted to a size_t so NULL gives 0 */ - break; - } - case "tostring": { - let s = lua.lua_tostring(L1, getindex(L, L1, pc)); - let s1 = lua.lua_pushstring(L1, s); - assert((s === null && s1 === null) || s.join('|') === s1.join('|')); - break; - } - case "type": { - lua.lua_pushstring(L1, lauxlib.luaL_typename(L1, getnum(L, L1, pc))); - break; - } - case "xmove": { - let f = getindex(L, L1, pc); - let t = getindex(L, L1, pc); - let fs = (f === 0) ? L1 : lua.lua_tothread(L1, f); - let ts = (t === 0) ? L1 : lua.lua_tothread(L1, t); - let n = getnum(L, L1, pc); - if (n === 0) n = lua.lua_gettop(fs); - lua.lua_xmove(fs, ts, n); - break; - } - case "yield": { - return lua.lua_yield(L1, getnum(L, L1, pc)); - } - case "yieldk": { - let nres = getnum(L, L1, pc); - let i = getindex(L, L1, pc); - return lua.lua_yieldk(L1, nres, i, Cfunck); - } - default: - lauxlib.luaL_error(L, lua.to_luastring("unknown instruction %s"), buff); + case "pushnum": { + lua.lua_pushnumber(L1, getnum(L, L1, pc)); + break; + } + case "pushstatus": { + pushcode(L1, status); + break; + } + case "pushstring": { + lua.lua_pushstring(L1, getstring(L, buff, pc)); + break; + } + case "pushupvalueindex": { + lua.lua_pushinteger(L1, lua.lua_upvalueindex(getnum(L, L1, pc))); + break; + } + case "pushvalue": { + lua.lua_pushvalue(L1, getindex(L, L1, pc)); + break; + } + case "rawgeti": { + let t = getindex(L, L1, pc); + lua.lua_rawgeti(L1, t, getnum(L, L1, pc)); + break; + } + case "rawgetp": { + let t = getindex(L, L1, pc); + lua.lua_rawgetp(L1, t, getnum(L, L1, pc)); + break; + } + case "rawsetp": { + let t = getindex(L, L1, pc); + lua.lua_rawsetp(L1, t, getnum(L, L1, pc)); + break; + } + case "remove": { + lua.lua_remove(L1, getnum(L, L1, pc)); + break; + } + case "replace": { + lua.lua_replace(L1, getindex(L, L1, pc)); + break; + } + case "resume": { + let i = getindex(L, L1, pc); + status = lua.lua_resume(lua.lua_tothread(L1, i), L, getnum(L, L1, pc)); + break; + } + case "return": { + let n = getnum(L, L1, pc); + if (L1 != L) { + let i; + for (i = 0; i < n; i++) + lua.lua_pushstring(L, lua.lua_tostring(L1, -(n - i))); + } + return n; + } + case "rotate": { + let i = getindex(L, L1, pc); + lua.lua_rotate(L1, i, getnum(L, L1, pc)); + break; + } + case "setfield": { + let t = getindex(L, L1, pc); + lua.lua_setfield(L1, t, getstring(L, buff, pc)); + break; + } + case "setglobal": { + lua.lua_setglobal(L1, getstring(L, buff, pc)); + break; + } + case "sethook": { + let mask = getnum(L, L1, pc); + let count = getnum(L, L1, pc); + sethookaux(L1, mask, count, getstring(L, buff, pc)); + break; + } + case "setmetatable": { + lua.lua_setmetatable(L1, getindex(L, L1, pc)); + break; + } + case "settable": { + lua.lua_settable(L1, getindex(L, L1, pc)); + break; + } + case "settop": { + lua.lua_settop(L1, getnum(L, L1, pc)); + break; + } + case "testudata": { + let i = getindex(L, L1, pc); + lua.lua_pushboolean(L1, lauxlib.luaL_testudata(L1, i, getstring(L, buff, pc)) !== null); + break; + } + case "error": { + lua.lua_error(L1); + break; + } + case "throw": { + throw new Error(); + } + case "tobool": { + lua.lua_pushboolean(L1, lua.lua_toboolean(L1, getindex(L, L1, pc))); + break; + } + case "tocfunction": { + lua.lua_pushcfunction(L1, lua.lua_tocfunction(L1, getindex(L, L1, pc))); + break; + } + case "tointeger": { + lua.lua_pushinteger(L1, lua.lua_tointeger(L1, getindex(L, L1, pc))); + break; + } + case "tonumber": { + lua.lua_pushnumber(L1, lua.lua_tonumber(L1, getindex(L, L1, pc))); + break; + } + case "topointer": { + let p = lua.lua_topointer(L1, getindex(L, L1, pc)); + if (p === null) p = 0; + else if (p.id) p = p.id; + lua.lua_pushnumber(L1, p); /* in ltests.c, p is casted to a size_t so NULL gives 0 */ + break; + } + case "tostring": { + let s = lua.lua_tostring(L1, getindex(L, L1, pc)); + let s1 = lua.lua_pushstring(L1, s); + assert((s === null && s1 === null) || s.join('|') === s1.join('|')); + break; + } + case "type": { + lua.lua_pushstring(L1, lauxlib.luaL_typename(L1, getnum(L, L1, pc))); + break; + } + case "xmove": { + let f = getindex(L, L1, pc); + let t = getindex(L, L1, pc); + let fs = (f === 0) ? L1 : lua.lua_tothread(L1, f); + let ts = (t === 0) ? L1 : lua.lua_tothread(L1, t); + let n = getnum(L, L1, pc); + if (n === 0) n = lua.lua_gettop(fs); + lua.lua_xmove(fs, ts, n); + break; + } + case "yield": { + return lua.lua_yield(L1, getnum(L, L1, pc)); + } + case "yieldk": { + let nres = getnum(L, L1, pc); + let i = getindex(L, L1, pc); + return lua.lua_yieldk(L1, nres, i, Cfunck); + } + default: + lauxlib.luaL_error(L, lua.to_luastring("unknown instruction %s"), buff); } - } - return 0; + } }; @@ -819,7 +816,7 @@ const buildop = function(p, pc) { const listcode = function(L) { lauxlib.luaL_argcheck(L, lua.lua_isfunction(L, 1) && !lua.lua_iscfunction(L, 1), - 1, lua.to_luastring("Lua function expected", true)); + 1, lua.to_luastring("Lua function expected", true)); let p = obj_at(L, 1); lua.lua_newtable(L); setnameval(L, lua.to_luastring("maxstack", true), p.maxstacksize); diff --git a/tests/test-suite/math.js b/tests/test-suite/math.js index ea021d2..0052bc2 100644 --- a/tests/test-suite/math.js +++ b/tests/test-suite/math.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/nextvar.js b/tests/test-suite/nextvar.js index 28a54e7..ad75f93 100644 --- a/tests/test-suite/nextvar.js +++ b/tests/test-suite/nextvar.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/pm.js b/tests/test-suite/pm.js index 6b9c767..ae3512e 100644 --- a/tests/test-suite/pm.js +++ b/tests/test-suite/pm.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/sort.js b/tests/test-suite/sort.js index 0b13861..9cee400 100644 --- a/tests/test-suite/sort.js +++ b/tests/test-suite/sort.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/strings.js b/tests/test-suite/strings.js index c501ddd..0efedcb 100644 --- a/tests/test-suite/strings.js +++ b/tests/test-suite/strings.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); @@ -38,7 +36,7 @@ test('[test-suite] strings: string comparisons', function (t) { assert('\\0\\0\\0' >= '\\0\\0\\0') assert(not ('\\0\\0b' < '\\0\\0a\\0')) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -80,7 +78,7 @@ test('[test-suite] strings: string.sub', function (t) { assert('\\0\\0\\0' >= '\\0\\0\\0') assert(not ('\\0\\0b' < '\\0\\0a\\0')) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -118,7 +116,7 @@ test('[test-suite] strings: string.find', function (t) { assert(string.find('', 'aaa', 1) == nil) assert(('alo(.)alo'):find('(.)', 1, 1) == 4) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -150,7 +148,7 @@ test('[test-suite] strings: string.len and #', function (t) { assert(#"\\0\\0\\0" == 3) assert(#"1234567890" == 10) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -207,7 +205,7 @@ test('[test-suite] strings: string.byte/string.char', function (t) { checkerror("too large", string.rep, 'a', (1 << 30), ',') end `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -244,7 +242,7 @@ test('[test-suite] strings: repetitions with separator', function (t) { for i=0,30 do assert(string.len(string.rep('a', i)) == i) end `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -296,7 +294,7 @@ test('[test-suite] strings: tostring', function (t) { assert(tostring(-1203 + 0.0) == "-1203") end `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -343,7 +341,7 @@ test('[test-suite] strings: string.format', function (t) { assert(string.format('"-%20s.20s"', string.rep("%", 2000)) == string.format("%q", "-"..string.rep("%", 2000)..".20s")) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -384,7 +382,7 @@ test('[test-suite] strings: %q', function (t) { checkerror("no literal", string.format, "%q", {}) end `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -411,7 +409,7 @@ test('[test-suite] strings: embedded zeros error', function (t) { assert(string.format("\\0%s\\0", "\\0\\0\\1") == "\\0\\0\\0\\1\\0") checkerror("contains zeros", string.format, "%10s", "\\0") `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -454,7 +452,7 @@ test('[test-suite] strings: format x tostring', function (t) { assert(string.format("%+08d", 31501) == "+0031501") assert(string.format("%+08d", -30927) == "-0030927") `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -491,7 +489,7 @@ test('[test-suite] strings: longest number that can be formatted', function (t) assert(tonumber(s) == -(10^i)) end `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -540,7 +538,7 @@ test('[test-suite] strings: large numbers for format', function (t) { end end `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -588,7 +586,7 @@ test("[test-suite] strings: 'format %a %A'", function (t) { assert(string.find(string.format("%a", 0/0), "^%-?nan")) assert(string.find(string.format("%a", -0.0), "^%-0x0")) end - + if not pcall(string.format, "%.3a", 0) then (Message or print)("\\n >>> modifiers for format '%a' not available <<<\\n") else @@ -597,7 +595,7 @@ test("[test-suite] strings: 'format %a %A'", function (t) { end end `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -637,7 +635,7 @@ test("[test-suite] strings: errors in format", function (t) { assert(load("return 1\\n--comment without ending EOL")() == 1) `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -688,7 +686,7 @@ test("[test-suite] strings: table.concat", function (t) { assert(table.concat(a, ",", 3) == "c") assert(table.concat(a, ",", 4) == "") `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -711,61 +709,59 @@ test("[test-suite] strings: table.concat", function (t) { // TODO: os.setlocale NYI -if (false) { - test("[test-suite] strings: locale", function (t) { - let luaCode = ` - if not _port then - - local locales = { "ptb", "pt_BR.iso88591", "ISO-8859-1" } - local function trylocale (w) - for i = 1, #locales do - if os.setlocale(locales[i], w) then - print(string.format("'%s' locale set to '%s'", w, locales[i])) - return locales[i] - end - end - print(string.format("'%s' locale not found", w)) - return false +test.skip("[test-suite] strings: locale", function (t) { + let luaCode = ` + if not _port then + + local locales = { "ptb", "pt_BR.iso88591", "ISO-8859-1" } + local function trylocale (w) + for i = 1, #locales do + if os.setlocale(locales[i], w) then + print(string.format("'%s' locale set to '%s'", w, locales[i])) + return locales[i] end + end + print(string.format("'%s' locale not found", w)) + return false + end - if trylocale("collate") then - assert("alo" < "álo" and "álo" < "amo") - end + if trylocale("collate") then + assert("alo" < "álo" and "álo" < "amo") + end - if trylocale("ctype") then - assert(string.gsub("áéíóú", "%a", "x") == "xxxxx") - assert(string.gsub("áÁéÉ", "%l", "x") == "xÁxÉ") - assert(string.gsub("áÁéÉ", "%u", "x") == "áxéx") - assert(string.upper"áÁé{xuxu}ção" == "ÁÁÉ{XUXU}ÇÃO") - end + if trylocale("ctype") then + assert(string.gsub("áéíóú", "%a", "x") == "xxxxx") + assert(string.gsub("áÁéÉ", "%l", "x") == "xÁxÉ") + assert(string.gsub("áÁéÉ", "%u", "x") == "áxéx") + assert(string.upper"áÁé{xuxu}ção" == "ÁÁÉ{XUXU}ÇÃO") + end - os.setlocale("C") - assert(os.setlocale() == 'C') - assert(os.setlocale(nil, "numeric") == 'C') + os.setlocale("C") + assert(os.setlocale() == 'C') + assert(os.setlocale(nil, "numeric") == 'C') - end - `, L; - - t.plan(2); + end + `, L; + + t.plan(2); - t.doesNotThrow(function () { + t.doesNotThrow(function () { - L = lauxlib.luaL_newstate(); + L = lauxlib.luaL_newstate(); - lualib.luaL_openlibs(L); + lualib.luaL_openlibs(L); - lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); + lauxlib.luaL_loadstring(L, lua.to_luastring(checkerror + luaCode)); - }, "Lua program loaded without error"); + }, "Lua program loaded without error"); - t.doesNotThrow(function () { + t.doesNotThrow(function () { - lua.lua_call(L, 0, -1); + lua.lua_call(L, 0, -1); - }, "Lua program ran without error"); + }, "Lua program ran without error"); - }); -} +}); test("[test-suite] strings: bug in Lua 5.3.2: 'gmatch' iterator does not work across coroutines", function (t) { @@ -777,7 +773,7 @@ test("[test-suite] strings: bug in Lua 5.3.2: 'gmatch' iterator does not work ac assert(co() == "2") end `, L; - + t.plan(2); t.doesNotThrow(function () { diff --git a/tests/test-suite/tpack.js b/tests/test-suite/tpack.js index 0754532..ebce4e4 100644 --- a/tests/test-suite/tpack.js +++ b/tests/test-suite/tpack.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/utf8.js b/tests/test-suite/utf8.js index 2da2d4a..11f699d 100644 --- a/tests/test-suite/utf8.js +++ b/tests/test-suite/utf8.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/test-suite/vararg.js b/tests/test-suite/vararg.js index f693870..dc90248 100644 --- a/tests/test-suite/vararg.js +++ b/tests/test-suite/vararg.js @@ -2,8 +2,6 @@ const test = require('tape'); -global.WEB = false; - const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); diff --git a/tests/tests.js b/tests/tests.js index 6c799e5..1bc4fc6 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -1,7 +1,5 @@ "use strict"; -global.WEB = false; - const lua = require("../src/lua.js"); const lauxlib = require("../src/lauxlib.js"); @@ -9,9 +7,9 @@ const toByteCode = function(luaCode) { let L = getState(luaCode); let b = []; if (lua.lua_dump(L, function(L, b, size, B) { - B.push(...b.slice(0, size)); - return 0; - }, b, false) !== 0) + B.push(...b.slice(0, size)); + return 0; + }, b, false) !== 0) throw Error("unable to dump given function"); return new DataView(Uint8Array.from(b).buffer); }; diff --git a/webpack.config.js b/webpack.config.js index f44822a..3916cf2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -30,7 +30,7 @@ module.exports = [ }, plugins: [ new webpack.DefinePlugin({ - WEB: JSON.stringify(true), + "typeof process": JSON.stringify("undefined") }) ] } @@ -12,6 +12,16 @@ acorn-dynamic-import@^2.0.0: dependencies: acorn "^4.0.3" +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + dependencies: + acorn "^3.0.4" + +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + acorn@^4.0.3: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" @@ -20,10 +30,18 @@ acorn@^5.0.0: version "5.1.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7" +acorn@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" + ajv-keywords@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.0.tgz#a296e17f7bfae7c1ce4f7e0de53d29cb32162df0" +ajv-keywords@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" + ajv@^4.9.1: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" @@ -40,6 +58,15 @@ ajv@^5.1.5: json-schema-traverse "^0.3.0" json-stable-stringify "^1.0.1" +ajv@^5.2.3, ajv@^5.3.0: + version "5.5.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.1.tgz#b38bb8876d9e86bee994956a04e721e88b248eb2" + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -48,6 +75,10 @@ align-text@^0.1.1, align-text@^0.1.3: longest "^1.0.1" repeat-string "^1.5.2" +ansi-escapes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -60,6 +91,12 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + anymatch@^1.3.0: version "1.3.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" @@ -78,6 +115,12 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + arr-diff@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" @@ -88,10 +131,24 @@ arr-flatten@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" +arrify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + asn1.js@^4.0.0: version "4.9.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.1.tgz#48ba240b45a9280e94748990ba597d216617fd40" @@ -140,7 +197,7 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" -babel-code-frame@^6.26.0: +babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" dependencies: @@ -742,6 +799,16 @@ builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + camelcase@^1.0.2: version "1.2.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" @@ -775,6 +842,18 @@ chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^2.0.0, chalk@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" + chokidar@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" @@ -797,6 +876,20 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: inherits "^2.0.1" safe-buffer "^5.0.1" +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + cliui@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" @@ -821,6 +914,16 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +color-convert@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + combined-stream@^1.0.5, combined-stream@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" @@ -835,6 +938,14 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" +concat-stream@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" + dependencies: + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + console-browserify@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" @@ -888,7 +999,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-spawn@^5.0.1: +cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" dependencies: @@ -939,6 +1050,12 @@ debug@^2.2.0, debug@^2.6.8: dependencies: ms "2.0.0" +debug@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + decamelize@^1.0.0, decamelize@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -955,6 +1072,10 @@ deep-extend@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + define-properties@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" @@ -970,6 +1091,18 @@ defined@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" @@ -999,6 +1132,12 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +doctrine@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075" + dependencies: + esutils "^2.0.2" + domain-browser@^1.1.1: version "1.1.7" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" @@ -1124,7 +1263,7 @@ es6-weak-map@^2.0.1: es6-iterator "^2.0.1" es6-symbol "^3.1.1" -escape-string-regexp@^1.0.2: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1137,6 +1276,72 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-scope@^3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint@^4.13.0: + version "4.13.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.13.0.tgz#1991aa359586af83877bde59de9d41f53e20826d" + dependencies: + ajv "^5.3.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.0.1" + doctrine "^2.0.2" + eslint-scope "^3.7.1" + espree "^3.5.2" + esquery "^1.0.0" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + ignore "^3.3.3" + imurmurhash "^0.1.4" + inquirer "^3.0.6" + is-resolvable "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" + strip-json-comments "~2.0.1" + table "^4.0.1" + text-table "~0.2.0" + +espree@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" + dependencies: + acorn "^5.2.1" + acorn-jsx "^3.0.0" + +esprima@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + +esquery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + dependencies: + estraverse "^4.0.0" + esrecurse@^4.1.0: version "4.2.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" @@ -1144,7 +1349,7 @@ esrecurse@^4.1.0: estraverse "^4.1.0" object-assign "^4.0.1" -estraverse@^4.1.0, estraverse@^4.1.1: +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" @@ -1198,6 +1403,14 @@ extend@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" +external-editor@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" + dependencies: + chardet "^0.4.0" + iconv-lite "^0.4.17" + tmp "^0.0.33" + extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" @@ -1212,6 +1425,14 @@ fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + faucet@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/faucet/-/faucet-0.0.1.tgz#597dcf1d2189a2c062321b591e8f151ed2039d9c" @@ -1224,6 +1445,19 @@ faucet@^0.0.1: tape "~2.3.2" through2 "~0.2.3" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" @@ -1252,6 +1486,15 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" +flat-cache@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" + dependencies: + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" + for-each@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.2.tgz#2c40450b9348e97f281322593ba96704b9abd4d4" @@ -1316,6 +1559,10 @@ function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -1356,7 +1603,7 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" -glob@^7.0.5, glob@~7.1.2: +glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@~7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -1367,10 +1614,25 @@ glob@^7.0.5, glob@~7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" +globals@^11.0.1: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.1.0.tgz#632644457f5f0e3ae711807183700ebf2e4633e4" + globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -1470,10 +1732,22 @@ https-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82" +iconv-lite@^0.4.17: + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" + ieee754@^1.1.4: version "1.1.8" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" +ignore@^3.3.3: + version "3.3.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + indexof@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" @@ -1497,6 +1771,25 @@ ini@~1.3.0: version "1.3.4" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" +inquirer@^3.0.6: + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^2.0.4" + figures "^2.0.0" + lodash "^4.3.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.1.0" + strip-ansi "^4.0.0" + through "^2.3.6" + interpret@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0" @@ -1595,6 +1888,22 @@ is-number@^3.0.0: dependencies: kind-of "^3.0.2" +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" + dependencies: + path-is-inside "^1.0.1" + is-posix-bracket@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" @@ -1603,12 +1912,22 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" dependencies: has "^1.0.1" +is-resolvable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" + dependencies: + tryit "^1.0.1" + is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -1647,6 +1966,13 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" +js-yaml@^3.9.1: + version "3.10.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -1671,6 +1997,10 @@ json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" @@ -1720,6 +2050,13 @@ lcid@^1.0.0: dependencies: invert-kv "^1.0.0" +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + load-json-file@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" @@ -1748,7 +2085,7 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" -lodash@^4.14.0, lodash@^4.17.4: +lodash@^4.14.0, lodash@^4.17.4, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -1870,10 +2207,18 @@ ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + nan@^2.3.0: version "2.7.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46" +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + node-libs-browser@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.0.0.tgz#a3a59ec97024985b46e958379646f96c4b616646" @@ -1991,6 +2336,23 @@ once@^1.3.0, once@^1.3.3: dependencies: wrappy "1" +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" + +optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + os-browserify@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.2.1.tgz#63fc4ccee5d2d7763d26bbf8601078e6c2e0044f" @@ -2073,6 +2435,10 @@ path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" +path-is-inside@^1.0.1, path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + path-key@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -2105,12 +2471,30 @@ pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" dependencies: find-up "^2.1.0" +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" @@ -2127,6 +2511,10 @@ process@^0.11.0: version "0.11.10" resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" @@ -2202,7 +2590,7 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" -readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.2.6: +readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.2.2, readable-stream@^2.2.6: version "2.3.3" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" dependencies: @@ -2329,12 +2717,30 @@ require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" +require-uncached@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + resolve@~1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" dependencies: path-parse "^1.0.5" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + resumer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" @@ -2347,7 +2753,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1: +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: @@ -2360,6 +2766,22 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^2.0.0" inherits "^2.0.1" +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + dependencies: + is-promise "^2.1.0" + +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" + safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -2396,7 +2818,7 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" -signal-exit@^3.0.0: +signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -2404,6 +2826,12 @@ slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + dependencies: + is-fullwidth-code-point "^2.0.0" + sntp@1.x.x: version "1.0.9" resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" @@ -2442,6 +2870,10 @@ sprintf-js@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.1.tgz#36be78320afe5801f6cea3ee78b6e5aab940ea0c" +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + sprintf@~0.1.3: version "0.1.5" resolved "https://registry.yarnpkg.com/sprintf/-/sprintf-0.1.5.tgz#8f83e39a9317c1a502cb7db8050e51c679f6edcf" @@ -2489,7 +2921,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0: +string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: @@ -2546,12 +2978,29 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" +supports-color@^4.0.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" + dependencies: + has-flag "^2.0.0" + supports-color@^4.2.1: version "4.4.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" dependencies: has-flag "^2.0.0" +table@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" + dependencies: + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" + tap-parser@~0.4.0: version "0.4.3" resolved "https://registry.yarnpkg.com/tap-parser/-/tap-parser-0.4.3.tgz#a4eae190c10d76c7a111921ff38bbe4d58f09eea" @@ -2613,6 +3062,10 @@ tar@^2.2.1: fstream "^1.0.2" inherits "2" +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + through2@~0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/through2/-/through2-0.2.3.tgz#eb3284da4ea311b6cc8ace3653748a52abf25a3f" @@ -2620,7 +3073,7 @@ through2@~0.2.3: readable-stream "~1.1.9" xtend "~2.1.1" -through@~2.3.4, through@~2.3.8: +through@^2.3.6, through@~2.3.4, through@~2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -2654,6 +3107,10 @@ trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" +tryit@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" @@ -2668,6 +3125,16 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + uglify-js@^2.8.29: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" @@ -2801,6 +3268,10 @@ wordwrap@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -2812,6 +3283,12 @@ wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + xtend@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" |