From eb838303ed7c3ddc2da0665ed0b5ca3843bf7b96 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 2 Mar 2017 11:15:02 +0100 Subject: [Parsing tests] SETUPVAL, GETUPVAL --- tests/lexparse.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) 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 -- cgit v1.2.3-54-g00ecf