Small improvements

This commit is contained in:
Him188 2019-11-22 19:10:10 +08:00
parent 0ea95c33e6
commit e1c4ff9cbd
6 changed files with 24 additions and 20 deletions

View File

@ -75,8 +75,6 @@ private fun Route.mirai(path: String, body: PipelineInterceptor<Unit, Applicatio
}
}
@Suppress("NOTHING_TO_INLINE")
suspend inline fun ApplicationCall.ok() = this.respond(HttpStatusCode.OK, "OK")
/**

View File

@ -121,12 +121,23 @@ kotlin {
}
}
sourceSets["commonTest"].apply {
dependencies {
kotlin("kotlin-test-annotations-common")
kotlin("kotlin-test-common")
}
kotlin.setSrcDirs(listOf("src/$name/kotlin"))
}
sourceSets["jvmTest"].apply {
dependencies {
kotlin("kotlin-test", kotlinVersion)
kotlin("kotlin-test-annotations-common", kotlinVersion)
kotlin("kotlin-test-junit5", kotlinVersion)
implementation("org.junit.jupiter:junit-jupiter-api:5.5.2")
}
kotlin.outputDir = file("build/classes/kotlin/jvm/test")
kotlin.setSrcDirs(listOf("src/$name/kotlin"))
}
sourceSets.all {

View File

@ -11,7 +11,6 @@ import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.protobuf.ProtoBuf
import net.mamoe.mirai.network.BotNetworkHandler
import net.mamoe.mirai.utils.io.ByteArrayPool
import net.mamoe.mirai.utils.io.debugPrint
import net.mamoe.mirai.utils.io.read
import net.mamoe.mirai.utils.io.toUHexString
import net.mamoe.mirai.utils.readProtoMap
@ -35,6 +34,8 @@ abstract class PacketFactory<out TPacket : Packet, TDecrypter : Decrypter>(val d
get() = (this::class.annotations.firstOrNull { it is AnnotatedId } as? AnnotatedId)
?: error("Annotation AnnotatedId not found for class ${this::class.simpleName}")
// TODO: 2019/11/22 修改为参数
/**
* ID.
*/

View File

@ -8,7 +8,6 @@ import kotlinx.io.pool.ObjectPool
import kotlin.random.Random
import kotlin.random.nextInt
/*
* 类型转换 Utils.
* 这些函数为内部函数, 可能会改变

View File

@ -0,0 +1,10 @@
package net.mamoe.mirai.utils.io
class TypeConversionTest {
//@Test
fun testConversions() {
}
}

View File

@ -70,21 +70,6 @@ suspend fun deserializeTest() {
""".trimIndent().replace("\n", " ").replace("[", "").replace("]", "")
.hexToBytes()
/*
00 00 00 07 00 00 00 52 08 01 12 03 98 01 02
10 02
22 [4E] 08 A0 89 F7 B6 03 10 A2 FF 8C F0 03 18 BB 92 94 BF 08 22 10 64 CF BB 65 00 13 8D B5 58 E2 45 1E EA 65 88 E1 28 04 30 02 38 20 40 FF 01 48 00 50 01 5A 05 32 36 39 33 33 60 00 68 00 70 00 78 00 80 01 97 04 88 01 ED 03 90 01 04 A0 01 01
*/
/*
for (i in 0..bytes.size) {
try {
println(bytes.copyOfRange(i, bytes.size).read { readProtoMap() })
} catch (e: Exception) {
}
}*/
println(bytes.read { readProtoMap() })
}