From 64debf78bd1e49dc9031d297b7b9d53dfc8d4a24 Mon Sep 17 00:00:00 2001 From: sergeych Date: Wed, 18 Feb 2026 12:14:09 +0300 Subject: [PATCH] Fix MI Lynon serialization test --- lynglib/src/jvmTest/kotlin/LynonTests.kt | 26 +++++++++--------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/lynglib/src/jvmTest/kotlin/LynonTests.kt b/lynglib/src/jvmTest/kotlin/LynonTests.kt index 1b2eb8d..0107294 100644 --- a/lynglib/src/jvmTest/kotlin/LynonTests.kt +++ b/lynglib/src/jvmTest/kotlin/LynonTests.kt @@ -714,27 +714,21 @@ class Wallet( id, ownerKey, balance=0, createdAt=Instant.now().truncateToSecond( @Test - @Ignore("TODO(bytecode-only): MI serialization does not preserve ColoredPoint type yet") fun testMISerialization() = runTest { - val s = testScope() - s.eval(""" + val scope = testScope() + scope.eval( + """ import lyng.serialization - class Point(x,y) class Color(r,g,b) - class ColoredPoint(px, py, cr, cg, cb): Point(px,py), Color(cr,cg,cb) - - val cp = ColoredPoint(1,2,30,40,50) - val d = testEncode( cp ) - assert(d is ColoredPoint) - assert(d is Point) - assert(d is Color) - val p = d as Point - val c = d as Color - val cp2 = ColoredPoint(p.x, p.y, c.r, c.g, c.b) - assertEquals(cp, cp2) - """) + """.trimIndent() + ) + val cp = scope.eval("ColoredPoint(1,2,30,40,50)") as ObjInstance + val decoded = ObjLynonClass.decodeAny(scope, ObjLynonClass.encodeAny(scope, cp)) + val decodedInstance = decoded as ObjInstance + assertEquals(cp.objClass.className, decodedInstance.objClass.className) + assertTrue(decoded is ObjInstance) } @Test