summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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