Skip to content

Commit

Permalink
Test boxed lists serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
bartblast committed Oct 17, 2024
1 parent 9cb0372 commit 15efb76
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/javascript/serializer_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,24 @@ describe("Serializer", () => {

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

it("list", () => {
const term = Type.list([Type.integer(1), Type.float(1.23)]);

const expected =
'{"type":"list","data":["__integer__:1","__float__:1.23"],"isProper":true}';

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

it("nested list", () => {
const term = {a: Type.list([Type.integer(1), Type.float(1.23)]), b: 2};

const expected =
'{"a":{"type":"list","data":["__integer__:1","__float__:1.23"],"isProper":true},"b":2}';

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

describe("JS terms", () => {
Expand Down

0 comments on commit 15efb76

Please sign in to comment.