From ed24912b2bfe3666a51760ca4b8e1a29ada12e25 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Mon, 6 Feb 2017 22:45:51 +0100 Subject: VARARG --- tests/lvm.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests') diff --git a/tests/lvm.js b/tests/lvm.js index c454bcf..62f9fff 100644 --- a/tests/lvm.js +++ b/tests/lvm.js @@ -239,6 +239,32 @@ test('TAILCALL', function (t) { vm.execute(); }, "Program executed without errors"); + t.strictEqual( + vm.L.stack[vm.L.top - 1].value, + 3, + "Program output is correct" + ); +}); + + +test('VARARG', function (t) { + let luaCode = ` + local f = function (a, b) + return a + b + end + + return f(1,2) + `, vm; + + t.plan(2); + + t.comment("Running following code: \n" + luaCode); + + t.doesNotThrow(function () { + vm = getVM(luaCode); + vm.execute(); + }, "Program executed without errors"); + t.strictEqual( vm.L.stack[vm.L.top - 1].value, 3, -- cgit v1.2.3-70-g09d2