From 0989db69a5c0b36b7b5c39f57510da879a0076b5 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Wed, 1 Mar 2017 15:59:14 +0100 Subject: [Parsing tests] TAILCALL --- tests/lexparse.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tests') diff --git a/tests/lexparse.js b/tests/lexparse.js index 1271a36..4747724 100644 --- a/tests/lexparse.js +++ b/tests/lexparse.js @@ -224,4 +224,35 @@ test('Multiple return', function (t) { [3, -1, 2], "Program output is correct" ); +}); + + +test('TAILCALL', function (t) { + let luaCode = ` + local f = function (a, b) + return a + b + end + + return f(1,2) + `, L; + + t.plan(2); + + t.doesNotThrow(function () { + + L = lauxlib.luaL_newstate(); + + linit.luaL_openlibs(L); + + lapi.lua_load(L, null, luaCode, "test", "text"); + + lapi.lua_call(L, 0, -1); + + }, "JS Lua program ran without error"); + + t.strictEqual( + lapi.lua_tointeger(L, -1), + 3, + "Program output is correct" + ); }); \ No newline at end of file -- cgit v1.2.3-54-g00ecf