File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
formats/json-tests/commonTest/src/kotlinx/serialization Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -146,8 +146,7 @@ class SerializersLookupTest : JsonTestBase() {
146146 @OptIn(ExperimentalUuidApi ::class )
147147 fun testLookupUuid () {
148148 assertSame<KSerializer <* >? > (Uuid .serializer(), serializerOrNull(typeOf<Uuid >()))
149- // TODO: uncomment in 2.1 release
150- // assertSame<KSerializer<*>?>(Uuid.serializer(), serializer<Uuid>())
149+ assertSame<KSerializer <* >? > (Uuid .serializer(), serializer<Uuid >())
151150 }
152151
153152 @Test
Original file line number Diff line number Diff line change @@ -18,19 +18,32 @@ class UuidTest : JsonTestBase() {
1818 assertJsonFormAndRestored(Uuid .serializer(), uuid, " \" $uuid \" " )
1919 }
2020
21- // TODO: write a test without @Contextual after 2.1.0 release
2221 @Serializable
23- data class Holder (@Contextual val uuid : Uuid )
22+ data class Holder (val uuid : Uuid )
23+
24+ @Serializable
25+ data class HolderContextual (@Contextual val uuid : Uuid )
2426
2527 val json = Json { serializersModule = serializersModuleOf(Uuid .serializer()) }
2628
2729 @Test
28- fun testNested () {
30+ fun testCompiled () {
2931 val fixed = Uuid .parse(" bc501c76-d806-4578-b45e-97a264e280f1" )
3032 assertJsonFormAndRestored(
3133 Holder .serializer(),
3234 Holder (fixed),
3335 """ {"uuid":"bc501c76-d806-4578-b45e-97a264e280f1"}""" ,
36+ Json
37+ )
38+ }
39+
40+ @Test
41+ fun testContextual () {
42+ val fixed = Uuid .parse(" bc501c76-d806-4578-b45e-97a264e280f1" )
43+ assertJsonFormAndRestored(
44+ HolderContextual .serializer(),
45+ HolderContextual (fixed),
46+ """ {"uuid":"bc501c76-d806-4578-b45e-97a264e280f1"}""" ,
3447 json
3548 )
3649 }
You can’t perform that action at this time.
0 commit comments