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_serializes_empty_object() { Assert.equal(CanonicalJSON.stringify({}), "{}");
});
add_task(async function test_canonicalJSON_serializes_empty_array() { Assert.equal(CanonicalJSON.stringify([]), "[]");
});
add_task(async function test_canonicalJSON_serializes_NaN() { Assert.equal(CanonicalJSON.stringify(NaN), "null");
});
add_task(async function test_canonicalJSON_serializes_inf() { // This isn't part of the JSON standard. Assert.equal(CanonicalJSON.stringify(Infinity), "null");
});
add_task(async function test_canonicalJSON_serializes_empty_string() { Assert.equal(CanonicalJSON.stringify(""), '""');
});
add_task(async function test_canonicalJSON_escapes_backslashes() { Assert.equal(CanonicalJSON.stringify("This\\and this"), '"This\\\\and this"');
});
add_task(async function test_canonicalJSON_handles_signed_zeros() { // do_check_eq doesn't support comparison of -0 and 0 properly. Assert.ok(CanonicalJSON.stringify(-0) === "-0"); Assert.ok(CanonicalJSON.stringify(0) === "0");
});
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.