rename testToJsonString and add new test for @Transient serialization

This commit is contained in:
Sergey Chernov 2026-01-18 20:34:58 +03:00
parent 8b94432f66
commit 7b1ba71ef0

View File

@ -887,7 +887,7 @@ class OOTest {
""".trimIndent()) """.trimIndent())
} }
@Test @Test
fun testToJsonString() = runTest { fun testToStringWithTransient() = runTest {
eval(""" eval("""
class C(amount,@Transient transient=0) { class C(amount,@Transient transient=0) {
val l by lazy { transient + amount } val l by lazy { transient + amount }
@ -903,4 +903,12 @@ class OOTest {
println(C(1).lock().lock().amount) println(C(1).lock().lock().amount)
""".trimIndent()) """.trimIndent())
} }
@Test
fun testToJsonString() = runTest {
eval("""
class T(a,b,@Transient c=0)
assertEquals("{\"a\":\"foo\",\"b\":\"bar\"}",T("foo", "bar").toJsonString())
""".trimIndent())
}
} }