diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-04-11 13:58:15 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-04-11 13:58:15 +0200 |
commit | 58fcb1d7f55424de904fd6ae53954b46d82aae8c (patch) | |
tree | b6969917ab16a139b918b33d29aa1c93ae66336c /tests | |
parent | ea8b3d63af92085d1563c670968152c7dbbb7642 (diff) | |
download | fengari-58fcb1d7f55424de904fd6ae53954b46d82aae8c.tar.gz fengari-58fcb1d7f55424de904fd6ae53954b46d82aae8c.tar.bz2 fengari-58fcb1d7f55424de904fd6ae53954b46d82aae8c.zip |
debug.upvalueid
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ldblib.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/ldblib.js b/tests/ldblib.js index 579912d..475c031 100644 --- a/tests/ldblib.js +++ b/tests/ldblib.js @@ -53,3 +53,39 @@ test('debug.getlocal', function (t) { ); }); + +test('debug.upvalueid', function (t) { + let luaCode = ` + local upvalue = "upvalue" + + local l = function() + return upvalue + end + + return debug.upvalueid(l, 1) + `, L; + + t.plan(3); + + t.doesNotThrow(function () { + + L = lauxlib.luaL_newstate(); + + linit.luaL_openlibs(L); + + lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + + }, "Lua program loaded without error"); + + t.doesNotThrow(function () { + + lapi.lua_call(L, 0, -1); + + }, "Lua program ran without error"); + + t.ok( + lapi.lua_touserdata(L, -1), + "Correct element(s) on the stack" + ); + +}); |