From 4eea48935f2e0ea1267d314f2900af2a1a4b8b02 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 17 Feb 2017 07:56:12 +0100 Subject: lua_pop --- tests/lapi.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/lapi.js') 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 -- cgit v1.2.3-54-g00ecf