Skip to content

Commit 450e6e3

Browse files
committed
Ensure that println is properly resolved in the JVM tests
In K2, the resolution rules changed, and we relied on the specific behavior of the K1 compiler.
1 parent e1342d2 commit 450e6e3

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

kotlinx-coroutines-core/common/test/TestBase.common.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public expect open class TestBase constructor() {
3939
public fun finish(index: Int)
4040
public fun ensureFinished() // Ensures that 'finish' was invoked
4141
public fun reset() // Resets counter and finish flag. Workaround for parametrized tests absence in common
42+
public fun println(message: Any?)
4243

4344
public fun runTest(
4445
expected: ((Throwable) -> Boolean)? = null,

kotlinx-coroutines-core/js/test/TestBase.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public actual open class TestBase actual constructor() {
7777
finished = false
7878
}
7979

80+
actual fun println(message: Any?) {
81+
kotlin.io.println(message)
82+
}
83+
8084
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
8185
public actual fun runTest(
8286
expected: ((Throwable) -> Boolean)? = null,

kotlinx-coroutines-core/jvm/test/TestBase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public actual open class TestBase(private var disableOutCheck: Boolean) {
153153
}
154154
})
155155

156-
fun println(message: Any?) {
156+
actual fun println(message: Any?) {
157157
if (disableOutCheck) kotlin.io.println(message)
158158
else previousOut.println(message)
159159
}

kotlinx-coroutines-core/native/test/TestBase.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public actual open class TestBase actual constructor() {
7373
finished.value = false
7474
}
7575

76+
actual fun println(message: Any?) {
77+
kotlin.io.println(message)
78+
}
79+
7680
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
7781
public actual fun runTest(
7882
expected: ((Throwable) -> Boolean)? = null,

0 commit comments

Comments
 (0)