summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lexparse.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/lexparse.js b/tests/lexparse.js
index 1132ef1..98f55bb 100644
--- a/tests/lexparse.js
+++ b/tests/lexparse.js
@@ -155,4 +155,37 @@ test('NEWTABLE', function (t) {
L.stack[lapi.index2addr_(L, -1)] instanceof Table,
"Program output is correct"
);
+});
+
+
+test('CALL', function (t) {
+ let luaCode = `
+ local f = function (a, b)
+ return a + b
+ end
+
+ local c = f(1, 2)
+
+ return c
+ `, 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