X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FSoneCommandTest.kt;h=3d5ccef9d61f599208ce034cd6b36694dbfaaa4a;hb=7522c3e795b53134beadd21c2e72fe48500bde6a;hp=3bdcb4ad32cee679c16ad7263051536dfed156d8;hpb=e79b0829db2fbfd9f50ad4526c638055b6304429;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt index 3bdcb4a..3d5ccef 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt @@ -95,6 +95,7 @@ abstract class SoneCommandTest { executeCommandAndExpectFcpException() } + protected operator fun SimpleFieldSet.plusAssign(keyValue: Pair) = putSingle(keyValue.first, keyValue.second) protected fun SimpleFieldSet.parsePost(prefix: String) = parseFromSimpleFieldSet(prefix, "ID", "Sone", "Recipient", "Time", "Text") protected fun SimpleFieldSet.parseReply(prefix: String) = parseFromSimpleFieldSet(prefix, "ID", "Sone", "Time", "Text") @@ -107,14 +108,14 @@ abstract class SoneCommandTest { expect("Sone", post.sone.id) { it["Sone"] } expect("recipient", post.recipientId.orNull()) { it["Recipient"] } expect("time", post.time.toString()) { it["Time"] } - expect("text", post.text) { it["Text"] } + expect("text", post.text.replace("\\", "\\\\").replace("\r", "\\r").replace("\n", "\\n")) { it["Text"] } } protected fun matchesReply(reply: PostReply) = OneByOneMatcher>().apply { expect("ID", reply.id) { it["ID"] } expect("Sone", reply.sone.id) { it["Sone"] } expect("time", reply.time.toString()) { it["Time"] } - expect("text", reply.text) { it["Text"] } + expect("text", reply.text.replace("\\", "\\\\").replace("\r", "\\r").replace("\n", "\\n")) { it["Text"] } } }