Skip to content

Ensure that println is properly resolved in the JVM tests #3955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kotlinx-coroutines-core/common/test/TestBase.common.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public expect open class TestBase constructor() {
public fun finish(index: Int)
public fun ensureFinished() // Ensures that 'finish' was invoked
public fun reset() // Resets counter and finish flag. Workaround for parametrized tests absence in common
public fun println(message: Any?)

public fun runTest(
expected: ((Throwable) -> Boolean)? = null,
Expand Down
4 changes: 4 additions & 0 deletions kotlinx-coroutines-core/js/test/TestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public actual open class TestBase actual constructor() {
finished = false
}

actual fun println(message: Any?) {
kotlin.io.println(message)
}

@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun runTest(
expected: ((Throwable) -> Boolean)? = null,
Expand Down
2 changes: 1 addition & 1 deletion kotlinx-coroutines-core/jvm/test/TestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public actual open class TestBase(private var disableOutCheck: Boolean) {
}
})

fun println(message: Any?) {
actual fun println(message: Any?) {
if (disableOutCheck) kotlin.io.println(message)
else previousOut.println(message)
}
Expand Down
4 changes: 4 additions & 0 deletions kotlinx-coroutines-core/native/test/TestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public actual open class TestBase actual constructor() {
finished.value = false
}

actual fun println(message: Any?) {
kotlin.io.println(message)
}

@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun runTest(
expected: ((Throwable) -> Boolean)? = null,
Expand Down