Fix tests

This commit is contained in:
Karlatemp 2022-03-30 15:01:07 +08:00
parent 629226553c
commit 7c87f2869b
No known key found for this signature in database
GPG Key ID: C6B606FF23D8FED7

View File

@ -30,6 +30,8 @@ class DebugLoggerTest : AbstractTest() {
JCE_DESERIALIZER_DEBUG = true JCE_DESERIALIZER_DEBUG = true
} }
fun String.uniteLine(): String = replace("\r\n", "\n").replace("\r", "\n")
@Serializable @Serializable
data class Struct( data class Struct(
@TarsId(1) val str: String, @TarsId(1) val str: String,
@ -53,7 +55,7 @@ class DebugLoggerTest : AbstractTest() {
name=int name=int
decodeElementIndex: currentHead == null decodeElementIndex: currentHead == null
endStructure: net.mamoe.mirai.internal.utils.io.serialization.tars.internal.DebugLoggerTest.Struct, null, null endStructure: net.mamoe.mirai.internal.utils.io.serialization.tars.internal.DebugLoggerTest.Struct, null, null
""".trimIndent(), out.toByteArray().decodeToString().trim() """.trimIndent(), out.toByteArray().decodeToString().trim().uniteLine()
) )
} }
@ -75,7 +77,8 @@ class DebugLoggerTest : AbstractTest() {
decodeElementIndex: TarsHead(tag=1, type=6(String1)) decodeElementIndex: TarsHead(tag=1, type=6(String1))
name=str name=str
decodeElementIndex: TarsHead(tag=3, type=0(Byte)) decodeElementIndex: TarsHead(tag=3, type=0(Byte))
""".trimIndent(), exception.message!!.trim() skipping Byte
""".trimIndent().trim(), exception.message!!.trim().uniteLine()
) )
} }
} }