summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-01 15:59:14 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 07:38:57 +0100
commit0989db69a5c0b36b7b5c39f57510da879a0076b5 (patch)
treed835b16950636161319f423dea14f89aef0958d9 /tests
parent19005492cf3b3597492e4fab9a2893dbdba1d42a (diff)
downloadfengari-0989db69a5c0b36b7b5c39f57510da879a0076b5.tar.gz
fengari-0989db69a5c0b36b7b5c39f57510da879a0076b5.tar.bz2
fengari-0989db69a5c0b36b7b5c39f57510da879a0076b5.zip
[Parsing tests] TAILCALL
Diffstat (limited to 'tests')
-rw-r--r--tests/lexparse.js31
1 files changed, 31 insertions, 0 deletions
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