aboutsummaryrefslogtreecommitdiff
path: root/tests/lexparse.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lexparse.js')
-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