summaryrefslogtreecommitdiff
path: root/tests/lapi.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-17 07:56:12 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-17 07:56:44 +0100
commit4eea48935f2e0ea1267d314f2900af2a1a4b8b02 (patch)
tree90f7e4d1bb08ea3626e56944235b4ce281c6d07d /tests/lapi.js
parente02fa80026ed5789e04ab865f238c8d184487dd2 (diff)
downloadfengari-4eea48935f2e0ea1267d314f2900af2a1a4b8b02.tar.gz
fengari-4eea48935f2e0ea1267d314f2900af2a1a4b8b02.tar.bz2
fengari-4eea48935f2e0ea1267d314f2900af2a1a4b8b02.zip
lua_pop
Diffstat (limited to 'tests/lapi.js')
-rw-r--r--tests/lapi.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lapi.js b/tests/lapi.js
index de7a401..fa1fb59 100644
--- a/tests/lapi.js
+++ b/tests/lapi.js
@@ -348,4 +348,34 @@ test('lua_call (calling a JS closure)', function (t) {
"upvalue hello !",
"top is correct"
);
+});
+
+
+test('lua_pop', function (t) {
+ let L;
+
+ t.plan(3);
+
+ t.doesNotThrow(function () {
+
+ L = lauxlib.luaL_newstate();
+
+ lapi.lua_pushstring(L, "hello");
+ lapi.lua_pushstring(L, "world");
+
+ lapi.lua_pop(L, 1);
+
+ }, "JS Lua program ran without error");
+
+ t.strictEqual(
+ lapi.lua_gettop(L),
+ 1,
+ "top is correct"
+ );
+
+ t.strictEqual(
+ lapi.lua_tostring(L, -1),
+ "hello",
+ "Correct element(s) on the stack"
+ );
}); \ No newline at end of file