summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lexparse.js54
-rw-r--r--tests/load.js12
-rw-r--r--tests/lstrlib.js42
-rw-r--r--tests/lua.js2
-rw-r--r--tests/lutf8lib.js11
-rw-r--r--tests/single.lua2
6 files changed, 62 insertions, 61 deletions
diff --git a/tests/lexparse.js b/tests/lexparse.js
index edffe53..92901b1 100644
--- a/tests/lexparse.js
+++ b/tests/lexparse.js
@@ -31,7 +31,7 @@ test('LOADK, RETURN', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -71,7 +71,7 @@ test('MOVE', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -111,7 +111,7 @@ test('Binary op', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -151,7 +151,7 @@ test('Unary op, LOADBOOL', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -189,7 +189,7 @@ test('NEWTABLE', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -231,7 +231,7 @@ test('CALL', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -277,7 +277,7 @@ test('Multiple return', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -318,7 +318,7 @@ test('TAILCALL', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -359,7 +359,7 @@ test('VARARG', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -398,7 +398,7 @@ test('LE, JMP', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -437,7 +437,7 @@ test('LT', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -476,7 +476,7 @@ test('EQ', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -516,7 +516,7 @@ test('TESTSET (and)', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -556,7 +556,7 @@ test('TESTSET (or)', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -600,7 +600,7 @@ test('TEST (false)', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -643,7 +643,7 @@ test('FORPREP, FORLOOP (int)', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -686,7 +686,7 @@ test('FORPREP, FORLOOP (float)', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -728,7 +728,7 @@ test('SETTABLE, GETTABLE', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -779,7 +779,7 @@ test('SETUPVAL, GETUPVAL', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -821,7 +821,7 @@ test('SETTABUP, GETTABUP', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -871,7 +871,7 @@ test('SELF', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -910,7 +910,7 @@ test('SETLIST', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -953,7 +953,7 @@ test('Variable SETLIST', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -991,7 +991,7 @@ test('Long SETLIST', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -1046,7 +1046,7 @@ test('TFORCALL, TFORLOOP', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -1087,7 +1087,7 @@ test('LEN', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
@@ -1136,7 +1136,7 @@ test('CONCAT', function (t) {
let reader = function(L, data) {
let code = luaCode ? luaCode.trim() : null;
luaCode = null;
- return code;
+ return code ? lua.to_luastring(code) : null;
};
lapi.lua_load(L, reader, luaCode, lua.to_luastring("test"), lua.to_luastring("text"));
diff --git a/tests/load.js b/tests/load.js
index 9a53176..00ed90a 100644
--- a/tests/load.js
+++ b/tests/load.js
@@ -28,7 +28,7 @@ test('luaL_loadstring', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -61,7 +61,7 @@ test('load', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -96,7 +96,7 @@ test('luaL_loadbuffer', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadbuffer(L, bc, null, "test");
+ lauxlib.luaL_loadbuffer(L, bc, null, lua.to_luastring("test"));
}, "Lua program loaded without error");
@@ -129,7 +129,7 @@ test('loadfile', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -162,7 +162,7 @@ test('loadfile (binary)', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -194,7 +194,7 @@ test('dofile', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
diff --git a/tests/lstrlib.js b/tests/lstrlib.js
index 2bde19d..0fa9115 100644
--- a/tests/lstrlib.js
+++ b/tests/lstrlib.js
@@ -26,7 +26,7 @@ test('string.len', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -64,7 +64,7 @@ test('string.char', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -95,7 +95,7 @@ test('string.upper, string.lower', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -132,7 +132,7 @@ test('string.rep', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -163,7 +163,7 @@ test('string.reverse', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -194,7 +194,7 @@ test('string.byte', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -237,7 +237,7 @@ test('string.format', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -268,7 +268,7 @@ test('string.format', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -299,7 +299,7 @@ test('string.format', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -340,7 +340,7 @@ test('string.sub', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -439,7 +439,7 @@ test('string.dump', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode.trim());
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode.trim()));
}, "Lua program loaded without error");
@@ -479,7 +479,7 @@ test('string.pack/unpack/packsize', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -515,7 +515,7 @@ test('string.find without pattern', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -552,7 +552,7 @@ test('string.match', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -589,7 +589,7 @@ test('string.find', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -645,7 +645,7 @@ test('string.gmatch', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -694,7 +694,7 @@ test('string.gsub', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -731,7 +731,7 @@ test('string.gsub (number)', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -768,7 +768,7 @@ test('string.gsub (pattern)', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -807,7 +807,7 @@ test('string.gsub (function)', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -846,7 +846,7 @@ test('string.gsub (table)', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
diff --git a/tests/lua.js b/tests/lua.js
index b2e0a6b..04b8250 100644
--- a/tests/lua.js
+++ b/tests/lua.js
@@ -20,7 +20,7 @@ test('string.lua', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
diff --git a/tests/lutf8lib.js b/tests/lutf8lib.js
index 7832bae..e32409b 100644
--- a/tests/lutf8lib.js
+++ b/tests/lutf8lib.js
@@ -3,6 +3,7 @@
const test = require('tape');
const tests = require("./tests.js");
+const lua = require("../src/lua.js");
const lapi = require("../src/lapi.js");
const lauxlib = require("../src/lauxlib.js");
const linit = require('../src/linit.js');
@@ -20,7 +21,7 @@ test('utf8.offset', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -52,7 +53,7 @@ test('utf8.codepoint', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -96,7 +97,7 @@ test('utf8.char', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -128,7 +129,7 @@ test('utf8.len', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
@@ -165,7 +166,7 @@ test('utf8.codes', function (t) {
linit.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, luaCode);
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
}, "Lua program loaded without error");
diff --git a/tests/single.lua b/tests/single.lua
index 127a708..f5f63f3 100644
--- a/tests/single.lua
+++ b/tests/single.lua
@@ -177,7 +177,7 @@ do
local nv = load("return " .. s)()
assert(v == nv and math.type(v) == math.type(nv))
end
- -- checkQ("\0\0\1\255\u{234}")
+ checkQ("\0\0\1\255\u{234}")
checkQ(math.maxinteger)
checkQ(math.mininteger)
checkQ(math.pi)