blob: c9029ac18d924b656b79c3bbd7a591e9fbec0b09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/*
* Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.serialization.cbor
import kotlinx.serialization.*
import kotlinx.serialization.internal.*
import kotlin.test.*
class CborRootLevelNullsTest {
@Serializable
data class Simple(val a: Int = 42)
@Test
fun testNull() {
val obj: Simple? = null
val content = (Cbor as BinaryFormat).dump(makeNullable(Simple.serializer()), obj)
assertTrue(content.contentEquals(byteArrayOf(0xf6.toByte())))
}
}
|