diff --git a/src/test/kotlin/com/shr4pnel/ferretirc/IRCErrTest.kt b/src/test/kotlin/com/shr4pnel/ferretirc/IRCErrTest.kt new file mode 100644 index 0000000..34bbd30 --- /dev/null +++ b/src/test/kotlin/com/shr4pnel/ferretirc/IRCErrTest.kt @@ -0,0 +1,38 @@ +package com.shr4pnel.ferretirc + +import io.github.oshai.kotlinlogging.KotlinLogging +import kotlinx.coroutines.runBlocking +import org.junit.jupiter.api.BeforeAll +import java.io.File + +class IRCErrTest { + companion object { + lateinit var processes: MutableList + val client = IrcClient("localhost", 6667, enableLogging = true) + private val logger = KotlinLogging.logger {} + + @JvmStatic + @BeforeAll + fun setup(): Unit = + runBlocking { + val logFile = File("src/test/resources/logs/ngircd.log") + val ngircdConfigPath = javaClass.classLoader.getResource("ngircd.conf")!!.path + logFile.createNewFile() + processes = + ProcessBuilder.startPipeline( + listOf( + // Run IRC server in [-d] debug log mode, with [-n] no daemon, using config [-f] file at path + ProcessBuilder("ngircd", "-dnf", ngircdConfigPath).redirectErrorStream(true), + // Remove unhelpful default ngircd info [PID. relative time, GID?] + ProcessBuilder("sed", "-ue", "s/\\[[^][]*\\]//g"), + // Add relative timestamp + ProcessBuilder("ts", "-s", "%H:%M:%.S").redirectOutput(logFile), + ), + ) + client.connect() + client.register("shr4p", "Tyler Fullname", "password") + val default = client.server.fetchChannels().first() + client.join(default) + } + } +}