diff options
Diffstat (limited to 'tests/ldebug.js')
-rw-r--r-- | tests/ldebug.js | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/tests/ldebug.js b/tests/ldebug.js index 0256465..751c9c2 100644 --- a/tests/ldebug.js +++ b/tests/ldebug.js @@ -9,7 +9,6 @@ const toByteCode = tests.toByteCode; const lvm = require("../src/lvm.js"); const ldo = require("../src/ldo.js"); -const lapi = require("../src/lapi.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); const linit = require('../src/linit.js'); @@ -30,15 +29,15 @@ test('luaG_typeerror', function (t) { linit.luaL_openlibs(L); - lapi.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); + lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); - lapi.lua_pcall(L, 0, -1, 0); + lua.lua_pcall(L, 0, -1, 0); }, "JS Lua program ran without error"); t.ok( - lapi.lua_tojsstring(L, -1).endsWith("attempt to get length of a boolean value (local 'a')"), + lua.lua_tojsstring(L, -1).endsWith("attempt to get length of a boolean value (local 'a')"), "Correct error was thrown" ); }); @@ -49,7 +48,7 @@ test('luaG_typeerror', function (t) { local a = true return a.yo `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -60,14 +59,14 @@ test('luaG_typeerror', function (t) { linit.luaL_openlibs(L); - lapi.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); + lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); - lapi.lua_pcall(L, 0, -1, 0); + lua.lua_pcall(L, 0, -1, 0); }, "JS Lua program ran without error"); t.ok( - lapi.lua_tojsstring(L, -1).endsWith("attempt to index a boolean value (local 'a')"), + lua.lua_tojsstring(L, -1).endsWith("attempt to index a boolean value (local 'a')"), "Correct error was thrown" ); }); @@ -89,14 +88,14 @@ test('luaG_typeerror', function (t) { linit.luaL_openlibs(L); - lapi.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); + lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); - lapi.lua_pcall(L, 0, -1, 0); + lua.lua_pcall(L, 0, -1, 0); }, "JS Lua program ran without error"); t.ok( - lapi.lua_tojsstring(L, -1).endsWith("attempt to index a boolean value (local 'a')"), + lua.lua_tojsstring(L, -1).endsWith("attempt to index a boolean value (local 'a')"), "Correct error was thrown" ); }); @@ -107,7 +106,7 @@ test('luaG_typeerror', function (t) { local a = true a.yo = 1 `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -118,14 +117,14 @@ test('luaG_typeerror', function (t) { linit.luaL_openlibs(L); - lapi.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); + lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); - lapi.lua_pcall(L, 0, -1, 0); + lua.lua_pcall(L, 0, -1, 0); }, "JS Lua program ran without error"); t.ok( - lapi.lua_tojsstring(L, -1).endsWith("attempt to index a boolean value (local 'a')"), + lua.lua_tojsstring(L, -1).endsWith("attempt to index a boolean value (local 'a')"), "Correct error was thrown" ); }); @@ -135,7 +134,7 @@ test('luaG_concaterror', function (t) { let luaCode = ` return {} .. 'hello' `, L; - + t.plan(2); t.doesNotThrow(function () { @@ -146,14 +145,14 @@ test('luaG_concaterror', function (t) { linit.luaL_openlibs(L); - lapi.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); + lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); - lapi.lua_pcall(L, 0, -1, 0); + lua.lua_pcall(L, 0, -1, 0); }, "JS Lua program ran without error"); t.ok( - lapi.lua_tojsstring(L, -1).endsWith("attempt to concatenate a table value"), + lua.lua_tojsstring(L, -1).endsWith("attempt to concatenate a table value"), "Correct error was thrown" ); }); @@ -174,14 +173,14 @@ test('luaG_opinterror', function (t) { linit.luaL_openlibs(L); - lapi.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); + lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); - lapi.lua_pcall(L, 0, -1, 0); + lua.lua_pcall(L, 0, -1, 0); }, "JS Lua program ran without error"); t.ok( - lapi.lua_tojsstring(L, -1).endsWith("attempt to perform arithmetic on a string value"), + lua.lua_tojsstring(L, -1).endsWith("attempt to perform arithmetic on a string value"), "Correct error was thrown" ); }); @@ -202,14 +201,14 @@ test('luaG_tointerror', function (t) { linit.luaL_openlibs(L); - lapi.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); + lua.lua_load(L, null, bc, lua.to_luastring("test-typeerror"), lua.to_luastring("binary")); - lapi.lua_pcall(L, 0, -1, 0); + lua.lua_pcall(L, 0, -1, 0); }, "JS Lua program ran without error"); t.ok( - lapi.lua_tojsstring(L, -1).endsWith("number has no integer representation"), + lua.lua_tojsstring(L, -1).endsWith("number has no integer representation"), "Correct error was thrown" ); }); |