Skip to content

Commit

Permalink
Fix tests on wasmJs
Browse files Browse the repository at this point in the history
  • Loading branch information
ajalt committed Jun 15, 2024
1 parent 70c6cb6 commit 1d1dcc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion test/graalvm/src/test/kotlin/GraalSmokeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -42,7 +43,9 @@ class GraalSmokeTest {
@Test
fun `raw mode test`() {
val t = Terminal(interactive = true)
assertNull(t.enterRawMode()?.use {})
assertThrows<RuntimeException> {
t.enterRawMode().use {}
}
}

@Test
Expand Down

0 comments on commit 1d1dcc5

Please sign in to comment.