File tree 2 files changed +17
-5
lines changed
formats/json-tests/commonTest/src/kotlinx/serialization
2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -146,8 +146,7 @@ class SerializersLookupTest : JsonTestBase() {
146
146
@OptIn(ExperimentalUuidApi ::class )
147
147
fun testLookupUuid () {
148
148
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 >())
151
150
}
152
151
153
152
@Test
Original file line number Diff line number Diff line change @@ -18,19 +18,32 @@ class UuidTest : JsonTestBase() {
18
18
assertJsonFormAndRestored(Uuid .serializer(), uuid, " \" $uuid \" " )
19
19
}
20
20
21
- // TODO: write a test without @Contextual after 2.1.0 release
22
21
@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 )
24
26
25
27
val json = Json { serializersModule = serializersModuleOf(Uuid .serializer()) }
26
28
27
29
@Test
28
- fun testNested () {
30
+ fun testCompiled () {
29
31
val fixed = Uuid .parse(" bc501c76-d806-4578-b45e-97a264e280f1" )
30
32
assertJsonFormAndRestored(
31
33
Holder .serializer(),
32
34
Holder (fixed),
33
35
""" {"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"}""" ,
34
47
json
35
48
)
36
49
}
You can’t perform that action at this time.
0 commit comments