summaryrefslogtreecommitdiff
path: root/tests/ltablib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-02 16:37:50 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-03 12:20:43 +1000
commitcb0295e52870f22c5dd1a1726342b8d4b147b1c5 (patch)
tree3655d4d6f4873ed246c00c0eb6680a06124f3046 /tests/ltablib.js
parent50820e54d065bffbb504e6b20b6c27802e102c25 (diff)
downloadfengari-cb0295e52870f22c5dd1a1726342b8d4b147b1c5.tar.gz
fengari-cb0295e52870f22c5dd1a1726342b8d4b147b1c5.tar.bz2
fengari-cb0295e52870f22c5dd1a1726342b8d4b147b1c5.zip
Refactor table implementation
Diffstat (limited to 'tests/ltablib.js')
-rw-r--r--tests/ltablib.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/ltablib.js b/tests/ltablib.js
index 00ce7c8..15f9e57 100644
--- a/tests/ltablib.js
+++ b/tests/ltablib.js
@@ -11,9 +11,9 @@ const lua = require('../src/lua.js');
const inttable2array = function(t) {
let a = [];
- t.forEach(function (v, k) {
+ t.strong.forEach(function (v, k) {
if (typeof k === 'number')
- a[k - 1] = v;
+ a[k - 1] = v.value;
});
return a.map(e => e.value);
@@ -70,9 +70,9 @@ test('table.pack', function (t) {
}, "JS Lua program ran without error");
t.deepEqual(
- [...lua.lua_topointer(L, -1).entries()]
+ [...lua.lua_topointer(L, -1).strong.entries()]
.filter(e => typeof e[0] === 'number') // Filter out the 'n' field
- .map(e => e[1].value).reverse(),
+ .map(e => e[1].value.value).reverse(),
[1, 2, 3],
"Correct element(s) on the stack"
);
@@ -145,9 +145,9 @@ test('table.insert', function (t) {
}, "JS Lua program ran without error");
t.deepEqual(
- [...lua.lua_topointer(L, -1).entries()]
+ [...lua.lua_topointer(L, -1).strong.entries()]
.filter(e => typeof e[0] === 'number')
- .map(e => e[1].value).sort(),
+ .map(e => e[1].value.value).sort(),
[1, 2, 3, 4, 5],
"Correct element(s) on the stack"
);
@@ -179,9 +179,9 @@ test('table.remove', function (t) {
}, "JS Lua program ran without error");
t.deepEqual(
- [...lua.lua_topointer(L, -1).entries()]
+ [...lua.lua_topointer(L, -1).strong.entries()]
.filter(e => typeof e[0] === 'number')
- .map(e => e[1].value).sort(),
+ .map(e => e[1].value.value).sort(),
[1, 2, 3, 4, null, null],
"Correct element(s) on the stack"
);
@@ -212,9 +212,9 @@ test('table.move', function (t) {
}, "JS Lua program ran without error");
t.deepEqual(
- [...lua.lua_topointer(L, -1).entries()]
+ [...lua.lua_topointer(L, -1).strong.entries()]
.filter(e => typeof e[0] === 'number')
- .map(e => e[1].value).sort(),
+ .map(e => e[1].value.value).sort(),
[1, 2, 3, 4, 5, 6],
"Correct element(s) on the stack"
);