summaryrefslogtreecommitdiff
path: root/tests/lcorolib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-04-26 17:55:37 +1000
committerdaurnimator <quae@daurnimator.com>2017-04-26 18:06:57 +1000
commitb688ef577a10e8b6f2cf948faaa8d1af70c7949c (patch)
tree0ff07d75f65442b92d8a95259b9ab6845e66b27a /tests/lcorolib.js
parent53bd1fcc4b90f24427064419354ad07c552a93d5 (diff)
downloadfengari-b688ef577a10e8b6f2cf948faaa8d1af70c7949c.tar.gz
fengari-b688ef577a10e8b6f2cf948faaa8d1af70c7949c.tar.bz2
fengari-b688ef577a10e8b6f2cf948faaa8d1af70c7949c.zip
Export lapi.js functions from lua.js
Diffstat (limited to 'tests/lcorolib.js')
-rw-r--r--tests/lcorolib.js37
1 files changed, 18 insertions, 19 deletions
diff --git a/tests/lcorolib.js b/tests/lcorolib.js
index 3a778d4..29f9b34 100644
--- a/tests/lcorolib.js
+++ b/tests/lcorolib.js
@@ -9,7 +9,6 @@ const toByteCode = tests.toByteCode;
const VM = 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');
@@ -39,14 +38,14 @@ test('coroutine.create, coroutine.yield, coroutine.resume', function (t) {
linit.luaL_openlibs(L);
- lapi.lua_load(L, null, bc, lua.to_luastring("test-coroutine"), lua.to_luastring("binary"));
+ lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine"), lua.to_luastring("binary"));
- lapi.lua_call(L, 0, -1);
+ lua.lua_call(L, 0, -1);
}, "JS Lua program ran without error");
t.strictEqual(
- lapi.lua_tonumber(L, -1),
+ lua.lua_tonumber(L, -1),
625,
"Correct element(s) on the stack"
);
@@ -82,20 +81,20 @@ test('coroutine.status', function (t) {
linit.luaL_openlibs(L);
- lapi.lua_load(L, null, bc, lua.to_luastring("test-coroutine.status"), lua.to_luastring("binary"));
+ lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.status"), lua.to_luastring("binary"));
- lapi.lua_call(L, 0, -1);
+ lua.lua_call(L, 0, -1);
}, "JS Lua program ran without error");
t.strictEqual(
- lapi.lua_tojsstring(L, -2),
+ lua.lua_tojsstring(L, -2),
"suspended",
"Correct element(s) on the stack"
);
t.strictEqual(
- lapi.lua_tojsstring(L, -1),
+ lua.lua_tojsstring(L, -1),
"dead",
"Correct element(s) on the stack"
);
@@ -123,19 +122,19 @@ test('coroutine.isyieldable', function (t) {
linit.luaL_openlibs(L);
- lapi.lua_load(L, null, bc, lua.to_luastring("test-coroutine.isyieldable"), lua.to_luastring("binary"));
+ lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.isyieldable"), lua.to_luastring("binary"));
- lapi.lua_call(L, 0, -1);
+ lua.lua_call(L, 0, -1);
}, "JS Lua program ran without error");
t.ok(
- lapi.lua_toboolean(L, -2),
+ lua.lua_toboolean(L, -2),
"Correct element(s) on the stack"
);
t.notOk(
- lapi.lua_toboolean(L, -1),
+ lua.lua_toboolean(L, -1),
"Correct element(s) on the stack"
);
});
@@ -164,19 +163,19 @@ test('coroutine.running', function (t) {
linit.luaL_openlibs(L);
- lapi.lua_load(L, null, bc, lua.to_luastring("test-coroutine.running"), lua.to_luastring("binary"));
+ lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.running"), lua.to_luastring("binary"));
- lapi.lua_call(L, 0, -1);
+ lua.lua_call(L, 0, -1);
}, "JS Lua program ran without error");
t.ok(
- lapi.lua_tothread(L, -2) instanceof lstate.lua_State,
+ lua.lua_tothread(L, -2) instanceof lstate.lua_State,
"Correct element(s) on the stack"
);
t.notOk(
- lapi.lua_toboolean(L, -1),
+ lua.lua_toboolean(L, -1),
"Correct element(s) on the stack"
);
});
@@ -205,14 +204,14 @@ test('coroutine.wrap', function (t) {
linit.luaL_openlibs(L);
- lapi.lua_load(L, null, bc, lua.to_luastring("test-coroutine.wrap"), lua.to_luastring("binary"));
+ lua.lua_load(L, null, bc, lua.to_luastring("test-coroutine.wrap"), lua.to_luastring("binary"));
- lapi.lua_call(L, 0, -1);
+ lua.lua_call(L, 0, -1);
}, "JS Lua program ran without error");
t.strictEqual(
- lapi.lua_tonumber(L, -1),
+ lua.lua_tonumber(L, -1),
625,
"Correct element(s) on the stack"
);