summaryrefslogtreecommitdiff
path: root/tests/lvm.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-02-06 22:45:51 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-02-06 22:45:51 +0100
commited24912b2bfe3666a51760ca4b8e1a29ada12e25 (patch)
treebf95967cd6284a517ab775abba33b07c3db297a0 /tests/lvm.js
parentdfc839625011d6bbc51c9415be4e55a6d4ffe45a (diff)
downloadfengari-ed24912b2bfe3666a51760ca4b8e1a29ada12e25.tar.gz
fengari-ed24912b2bfe3666a51760ca4b8e1a29ada12e25.tar.bz2
fengari-ed24912b2bfe3666a51760ca4b8e1a29ada12e25.zip
VARARG
Diffstat (limited to 'tests/lvm.js')
-rw-r--r--tests/lvm.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lvm.js b/tests/lvm.js
index c454bcf..62f9fff 100644
--- a/tests/lvm.js
+++ b/tests/lvm.js
@@ -244,4 +244,30 @@ test('TAILCALL', function (t) {
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,
+ "Program output is correct"
+ );
}); \ No newline at end of file