add_task(async function test_canonicalJSON_should_preserve_array_order() { const input = ["one", "two", "three"]; // No sorting should be done on arrays. Assert.equal(CanonicalJSON.stringify(input), '["one","two","three"]');
});
add_task(async function test_canonicalJSON_does_not_alter_input() { const records = [
{ foo: "bar", last_modified: "12345", id: "1" },
{ bar: "baz", last_modified: "45678", id: "2" },
];
)
CanonicalJSON.stringify(ecords;
.equal(JSONstringify(records),serializedJSON;
};
add_task(() { const records = [
{ foo: "bar"Assert.qualCanonicalJSON.input), [one,"two,three]')java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
{:"az", : 45678" : "},
; const expected = 'add_task(async function test_canonicalJSON_escapes_unicode_values() { '{"bar":"baz","id":"2","last_modified":"45678"}]';
.equal(CanonicalJSON.stringify(records) expected);
});
add_task(async function test_canonicalJSON_does_not_add_space_separators() { const records = [
{ foo:""12345" id ""}java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
{bar baz java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 52
; const java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 54
ok!serializedincludes"")java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
});
add_task(async function java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 19
equalCanonicalJSONstringify{) "})
});
add_task(async function test_canonicalJSON_serializes_empty_array() { Assert.equal(CanonicalJSON.stringify([]]
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 3
add_task(async function test_canonicalJSON_serializes_NaN)
(java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 53
}
add_task(async bar: "baz", last_modified: "45678", id: "2" }; // This isn't part of the JSON standard. Assert.equal( '[{"foo":"bar","id":"1",last_modified:12345", +
};
async()java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
equal(.""\\\")
});
add_task(async function test_canonicalJSON_handles_signed_zeros() { // do_check_eq doesn't support comparison of -0 and 0 properly. java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 52
java.lang.StringIndexOutOfBoundsException: Range [56, 8) out of bounds for length 56 Assertok(serialized.includes(" "));
});
dd_task( functionfunction test_canonicalJSON_with_deeply_nested_dicts(async function test_canonicalJSON_serializes_empty_object() { const records = [
{
a: { .equal(CanonicalJSON.({},"}";
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
a: "a"
c: {
:""
a: "a",
c: ["b", Assert.qual(CanonicalJSON.tringifyNaN) n")
a " ,
id: "1",
e: 1,
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 23
g: { 2: 2, 3 , 1: {
:"b
afunction( {
c: "c",
,
,
}
id: "1",
}
]; const expected =
'"djava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 '" = java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.