Espruino/tests/test_object_fromEntries.js
2023-02-13 18:05:40 +01:00

15 lines
308 B
JavaScript

var tests=0,testpass=0;
function test(a,b) {
tests++;
if (JSON.stringify(a)==JSON.stringify(b))
testpass++;
else
console.log("Got",a,"expected", b);
}
test(Object.fromEntries([['a',1],['b','c'],['d',true]]),{ a:1, b:'c', d:true });
test(Object.fromEntries([]),{});
result = tests==testpass;