summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 11:15:02 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 11:15:02 +0100
commiteb838303ed7c3ddc2da0665ed0b5ca3843bf7b96 (patch)
tree3ba43e0831339856af3a3c9776900878e2326540
parent8ffdadc19c526ae36490e626e226c6123ae2b3ff (diff)
downloadfengari-eb838303ed7c3ddc2da0665ed0b5ca3843bf7b96.tar.gz
fengari-eb838303ed7c3ddc2da0665ed0b5ca3843bf7b96.tar.bz2
fengari-eb838303ed7c3ddc2da0665ed0b5ca3843bf7b96.zip
[Parsing tests] SETUPVAL, GETUPVAL
-rw-r--r--tests/lexparse.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/lexparse.js b/tests/lexparse.js
index ca77054..50b9c3f 100644
--- a/tests/lexparse.js
+++ b/tests/lexparse.js
@@ -571,4 +571,39 @@ test('SETTABLE, GETTABLE', function (t) {
"world",
"Program output is correct"
);
+});
+
+
+test('SETUPVAL, GETUPVAL', function (t) {
+ let luaCode = `
+ local up = "hello"
+
+ local f = function ()
+ upup = "yo"
+ up = "world"
+ return up;
+ end
+
+ return f()
+ `, 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_tostring(L, -1),
+ "world",
+ "Program output is correct"
+ );
}); \ No newline at end of file