From 3e16f28d4eb8691296f4b93588186099474566f4 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 2 Mar 2017 07:44:31 +0100 Subject: [Parsing tests] VARARG --- tests/lexparse.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/lexparse.js b/tests/lexparse.js index 4747724..36dbf97 100644 --- a/tests/lexparse.js +++ b/tests/lexparse.js @@ -255,4 +255,35 @@ test('TAILCALL', function (t) { 3, "Program output is correct" ); +}); + + +test('VARARG', function (t) { + let luaCode = ` + local f = function (...) + return ... + end + + return f(1,2,3) + `, 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.deepEqual( + L.stack.slice(L.top - 3, L.top).map(e => e.value), + [1, 2, 3], + "Program output is correct" + ); }); \ No newline at end of file -- cgit v1.2.3-70-g09d2