From ebbcbf8484d74cfccd0b39abf661dbc14fd2dc5d Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 16 Feb 2017 07:51:01 +0100 Subject: lua_pushnumber --- tests/lapi.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/lapi.js') diff --git a/tests/lapi.js b/tests/lapi.js index 39477b2..251c5a8 100644 --- a/tests/lapi.js +++ b/tests/lapi.js @@ -36,4 +36,31 @@ test('luaL_newstate, lua_pushnil, lua_gettop, luaL_typename', function (t) { "nil", "Correct element(s) on the stack" ); +}); + + +test('lua_pushnumber', function (t) { + let L; + + t.plan(3); + + t.doesNotThrow(function () { + + L = lauxlib.luaL_newstate(); + + lapi.lua_pushnumber(L, 10); + + }, "JS Lua program ran without error"); + + t.strictEqual( + lapi.lua_gettop(L), + 1, + "top is correct" + ); + + t.strictEqual( + lauxlib.luaL_typename(L, lapi.lua_gettop(L)), + "number", + "Correct element(s) on the stack" + ); }); \ No newline at end of file -- cgit v1.2.3-54-g00ecf