Skip to content

Commit

Permalink
Test object keys escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
bartblast committed Oct 17, 2024
1 parent 96523a1 commit 2db6e52
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/javascript/serializer_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,15 @@ describe("Serializer", () => {

describe("object", () => {
it("top-level", () => {
const term = {a: 1, b: 2.34};
const expected = '[1,{"a":1,"b":2.34}]';
const term = {a: 1, 'b"cd': 2.34};
const expected = '[1,{"a":1,"b\\"cd":2.34}]';

assert.equal(serialize(term), expected);
});

it("nested", () => {
const term = {a: 1, b: {c: 3.45, d: "xyz"}};
const expected = '[1,{"a":1,"b":{"c":3.45,"d":"xyz"}}]';
const term = {a: 1, b: {c: 3.45, 'd"ef': "xyz"}};
const expected = '[1,{"a":1,"b":{"c":3.45,"d\\"ef":"xyz"}}]';

assert.equal(serialize(term), expected);
});
Expand Down

0 comments on commit 2db6e52

Please sign in to comment.