summaryrefslogtreecommitdiff
path: root/tests/lvm.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-06 11:30:50 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-02-06 22:12:39 +0100
commitdfc839625011d6bbc51c9415be4e55a6d4ffe45a (patch)
tree477a786adb8d0a6521b73d50b9e6abff689f8f44 /tests/lvm.js
parent0926e6a6d00ee13e594e87ec8fc06f8e754eb145 (diff)
downloadfengari-dfc839625011d6bbc51c9415be4e55a6d4ffe45a.tar.gz
fengari-dfc839625011d6bbc51c9415be4e55a6d4ffe45a.tar.bz2
fengari-dfc839625011d6bbc51c9415be4e55a6d4ffe45a.zip
TAILCALL
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 0a71bf8..c454bcf 100644
--- a/tests/lvm.js
+++ b/tests/lvm.js
@@ -219,3 +219,29 @@ test('Multiple return', function (t) {
"Program output is correct"
);
});
+
+
+test('TAILCALL', 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