summaryrefslogtreecommitdiff
path: root/tests/lapi.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lapi.js')
-rw-r--r--tests/lapi.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/lapi.js b/tests/lapi.js
index 561841f..298328c 100644
--- a/tests/lapi.js
+++ b/tests/lapi.js
@@ -476,4 +476,32 @@ test('lua_newtable', function (t) {
lapi.lua_istable(L, -1),
"Correct element(s) on the stack"
);
+});
+
+
+test('lua_settable, lua_gettable', function (t) {
+ let L;
+
+ t.plan(2);
+
+ t.doesNotThrow(function () {
+ L = lauxlib.luaL_newstate();
+
+ lapi.lua_newtable(L);
+
+ lapi.lua_pushstring(L, "key");
+ lapi.lua_pushstring(L, "value");
+
+ lapi.lua_settable(L, -3);
+
+ lapi.lua_pushstring(L, "key");
+ lapi.lua_gettable(L, -2);
+
+ }, "JS Lua program ran without error");
+
+ t.strictEqual(
+ lapi.lua_tostring(L, -1),
+ "value",
+ "Correct element(s) on the stack"
+ );
}); \ No newline at end of file