fixed BJSON array serialization (#457)

This commit is contained in:
Fabrice Bellard
2025-11-15 14:52:50 +01:00
parent 4bd485d713
commit fcbf5ea2a6
2 changed files with 67 additions and 20 deletions

View File

@@ -184,7 +184,18 @@ function bjson_test_all()
var obj;
bjson_test({x:1, y:2, if:3});
bjson_test([1, 2, 3]);
/* array with holes */
bjson_test([1, , 2, , 3]);
/* fast array with hole */
obj = new Array(5);
obj[0] = 1;
obj[1] = 2;
bjson_test(obj);
bjson_test([1.0, "aa", true, false, undefined, null, NaN, -Infinity, -0.0]);
if (typeof BigInt !== "undefined") {
bjson_test([BigInt("1"), -BigInt("0x123456789"),