summaryrefslogtreecommitdiff
path: root/tests/lapi.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-17 14:13:10 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-17 14:13:10 +0100
commit78b48979b8dbd367043c39fb21007ab4f54cd0a4 (patch)
treef944c36322bad140da8b8bd69aa7c1c17944ab87 /tests/lapi.js
parentea562b1094672f641707c0f809827a0d3a982f23 (diff)
downloadfengari-78b48979b8dbd367043c39fb21007ab4f54cd0a4.tar.gz
fengari-78b48979b8dbd367043c39fb21007ab4f54cd0a4.tar.bz2
fengari-78b48979b8dbd367043c39fb21007ab4f54cd0a4.zip
lua_settable, lua_gettable
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