diff options
author | daurnimator <quae@daurnimator.com> | 2017-04-26 17:55:37 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-04-26 18:06:57 +1000 |
commit | b688ef577a10e8b6f2cf948faaa8d1af70c7949c (patch) | |
tree | 0ff07d75f65442b92d8a95259b9ab6845e66b27a /tests/ldebug.js | |
parent | 53bd1fcc4b90f24427064419354ad07c552a93d5 (diff) | |
download | fengari-b688ef577a10e8b6f2cf948faaa8d1af70c7949c.tar.gz fengari-b688ef577a10e8b6f2cf948faaa8d1af70c7949c.tar.bz2 fengari-b688ef577a10e8b6f2cf948faaa8d1af70c7949c.zip |
Export lapi.js functions from lua.js
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" ); }); |