summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-06-18 23:51:31 +1000
committerdaurnimator <quae@daurnimator.com>2017-06-18 23:52:56 +1000
commit4f0c9181f38355cb74393f6f6cbba56b8bd52e18 (patch)
tree47f98aea519105caa1e8c869651681fe418e99c0 /tests
parentf813a48d45f231965050872534666fee73cbb053 (diff)
downloadfengari-4f0c9181f38355cb74393f6f6cbba56b8bd52e18.tar.gz
fengari-4f0c9181f38355cb74393f6f6cbba56b8bd52e18.tar.bz2
fengari-4f0c9181f38355cb74393f6f6cbba56b8bd52e18.zip
tests/tests.js: throw errors if unable to load code
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/tests.js b/tests/tests.js
index 4170f67..75e5e19 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -24,8 +24,11 @@ const toByteCode = function (luaCode) {
const getState = function(luaCode) {
let L = lauxlib.luaL_newstate();
+ if (!L)
+ throw Error("unable to create lua_State");
- lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
+ if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) !== lua.LUA_OK)
+ return Error(lua.lua_tojsstring(L, -1));
return L;
};