From 1d1dcc5c782a0626bbaa904f5215e23130d770ad Mon Sep 17 00:00:00 2001 From: AJ Date: Sat, 15 Jun 2024 14:54:15 -0700 Subject: [PATCH] Fix tests on wasmJs --- .../kotlin/com/github/ajalt/mordant/test/TestUtils.kt | 2 +- test/graalvm/src/test/kotlin/GraalSmokeTest.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mordant/src/commonTest/kotlin/com/github/ajalt/mordant/test/TestUtils.kt b/mordant/src/commonTest/kotlin/com/github/ajalt/mordant/test/TestUtils.kt index 7a677d805..96b813781 100644 --- a/mordant/src/commonTest/kotlin/com/github/ajalt/mordant/test/TestUtils.kt +++ b/mordant/src/commonTest/kotlin/com/github/ajalt/mordant/test/TestUtils.kt @@ -21,7 +21,7 @@ private val upMove = Regex("${Regex.escape(CSI)}\\d+A") // This handles the difference in wasm movements and the other targets fun TerminalRecorder.normalizedOutput(): String { - return if (CR_IMPLIES_LF) output().replace(upMove, "\r") else output() + return if (CR_IMPLIES_LF) output().replace("\r${CSI}1A", "\r") else output() } fun TerminalRecorder.latestOutput(): String { diff --git a/test/graalvm/src/test/kotlin/GraalSmokeTest.kt b/test/graalvm/src/test/kotlin/GraalSmokeTest.kt index bedc084eb..4477762c0 100644 --- a/test/graalvm/src/test/kotlin/GraalSmokeTest.kt +++ b/test/graalvm/src/test/kotlin/GraalSmokeTest.kt @@ -12,6 +12,7 @@ import com.github.ajalt.mordant.widgets.progress.progressBar import com.github.ajalt.mordant.widgets.progress.progressBarLayout import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import java.util.concurrent.TimeUnit import kotlin.test.Ignore import kotlin.test.assertNull @@ -42,7 +43,9 @@ class GraalSmokeTest { @Test fun `raw mode test`() { val t = Terminal(interactive = true) - assertNull(t.enterRawMode()?.use {}) + assertThrows { + t.enterRawMode().use {} + } } @Test