Skip to content

Commit

Permalink
Test boxed tuples serializing
Browse files Browse the repository at this point in the history
  • Loading branch information
bartblast committed Oct 17, 2024
1 parent 0791b3a commit 9642e2d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/javascript/serializer_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,29 @@ describe("Serializer", () => {
assert.equal(serialize(term), expected);
});
});

describe("tuple", () => {
it("top-level", () => {
const term = Type.tuple([Type.integer(1), Type.float(1.23)]);

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

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

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

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

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

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

0 comments on commit 9642e2d

Please sign in to comment.