From 15efb760a86058243c513663f07a35c55b0c5c79 Mon Sep 17 00:00:00 2001 From: Bart Blast Date: Thu, 17 Oct 2024 14:18:54 +0200 Subject: [PATCH] Test boxed lists serialization --- test/javascript/serializer_test.mjs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/javascript/serializer_test.mjs b/test/javascript/serializer_test.mjs index efdd2b6fb..c8fa1c124 100644 --- a/test/javascript/serializer_test.mjs +++ b/test/javascript/serializer_test.mjs @@ -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", () => {