summaryrefslogtreecommitdiff
path: root/tests/lexparse.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 07:44:31 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 07:44:31 +0100
commit3e16f28d4eb8691296f4b93588186099474566f4 (patch)
tree67a4a259d4d419c2f31fc22ba5f791bd4844da9d /tests/lexparse.js
parent0989db69a5c0b36b7b5c39f57510da879a0076b5 (diff)
downloadfengari-3e16f28d4eb8691296f4b93588186099474566f4.tar.gz
fengari-3e16f28d4eb8691296f4b93588186099474566f4.tar.bz2
fengari-3e16f28d4eb8691296f4b93588186099474566f4.zip
[Parsing tests] VARARG
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 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