summaryrefslogtreecommitdiff
path: root/tests/lapi.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-16 12:54:22 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-16 12:55:35 +0100
commit8f913dd74957ef18e144f15b78c3e55893744218 (patch)
treea47ff729efa6474c99d5371ec06272bed47a8417 /tests/lapi.js
parent573a9c3b39bf1570a575ce3f077a33e752439165 (diff)
downloadfengari-8f913dd74957ef18e144f15b78c3e55893744218.tar.gz
fengari-8f913dd74957ef18e144f15b78c3e55893744218.tar.bz2
fengari-8f913dd74957ef18e144f15b78c3e55893744218.zip
lua_tonumber, lua_tointeger, lua_tostring, lua_toboolean
Diffstat (limited to 'tests/lapi.js')
-rw-r--r--tests/lapi.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/lapi.js b/tests/lapi.js
index 8dd2680..875a89c 100644
--- a/tests/lapi.js
+++ b/tests/lapi.js
@@ -65,7 +65,7 @@ test('lua_pushnumber', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_tonumber(L, -1),
10.5,
"top is correct"
);
@@ -81,7 +81,7 @@ test('lua_pushinteger', function (t) {
L = lauxlib.luaL_newstate();
- lapi.lua_pushnumber(L, 10);
+ lapi.lua_pushinteger(L, 10);
}, "JS Lua program ran without error");
@@ -98,7 +98,7 @@ test('lua_pushinteger', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_tointeger(L, -1),
10,
"top is correct"
);
@@ -131,7 +131,7 @@ test('lua_pushstring', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_tostring(L, -1),
"hello",
"top is correct"
);
@@ -164,7 +164,7 @@ test('lua_pushboolean', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_toboolean(L, -1),
true,
"top is correct"
);
@@ -205,13 +205,13 @@ test('lua_pushvalue', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_tostring(L, -1),
"hello",
"top is correct"
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L) - 1].value,
+ lapi.lua_tostring(L, -2),
"hello",
"top is correct"
);