summaryrefslogtreecommitdiff
path: root/tests/lapi.js
diff options
context:
space:
mode:
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