summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/lexparse.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/lexparse.js b/tests/lexparse.js
index 4747724..36dbf97 100644
--- a/tests/lexparse.js
+++ b/tests/lexparse.js
@@ -255,4 +255,35 @@ test('TAILCALL', function (t) {
3,
"Program output is correct"
);
+});
+
+
+test('VARARG', function (t) {
+ let luaCode = `
+ local f = function (...)
+ return ...
+ end
+
+ return f(1,2,3)
+ `, 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.deepEqual(
+ L.stack.slice(L.top - 3, L.top).map(e => e.value),
+ [1, 2, 3],
+ "Program output is correct"
+ );
}); \ No newline at end of file