Fix MI Lynon serialization test
This commit is contained in:
parent
f0bcee407a
commit
64debf78bd
@ -714,27 +714,21 @@ class Wallet( id, ownerKey, balance=0, createdAt=Instant.now().truncateToSecond(
|
|||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore("TODO(bytecode-only): MI serialization does not preserve ColoredPoint type yet")
|
|
||||||
fun testMISerialization() = runTest {
|
fun testMISerialization() = runTest {
|
||||||
val s = testScope()
|
val scope = testScope()
|
||||||
s.eval("""
|
scope.eval(
|
||||||
|
"""
|
||||||
import lyng.serialization
|
import lyng.serialization
|
||||||
|
|
||||||
class Point(x,y)
|
class Point(x,y)
|
||||||
class Color(r,g,b)
|
class Color(r,g,b)
|
||||||
|
|
||||||
class ColoredPoint(px, py, cr, cg, cb): Point(px,py), Color(cr,cg,cb)
|
class ColoredPoint(px, py, cr, cg, cb): Point(px,py), Color(cr,cg,cb)
|
||||||
|
""".trimIndent()
|
||||||
val cp = ColoredPoint(1,2,30,40,50)
|
)
|
||||||
val d = testEncode( cp )
|
val cp = scope.eval("ColoredPoint(1,2,30,40,50)") as ObjInstance
|
||||||
assert(d is ColoredPoint)
|
val decoded = ObjLynonClass.decodeAny(scope, ObjLynonClass.encodeAny(scope, cp))
|
||||||
assert(d is Point)
|
val decodedInstance = decoded as ObjInstance
|
||||||
assert(d is Color)
|
assertEquals(cp.objClass.className, decodedInstance.objClass.className)
|
||||||
val p = d as Point
|
assertTrue(decoded is ObjInstance)
|
||||||
val c = d as Color
|
|
||||||
val cp2 = ColoredPoint(p.x, p.y, c.r, c.g, c.b)
|
|
||||||
assertEquals(cp, cp2)
|
|
||||||
""")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user