Skip to content

Commit f5b3f96

Browse files
authored
Ensure that println is properly resolved in the JVM tests (#3955)
In K2, the resolution rules changed, and we relied on the specific behavior of the K1 compiler.
1 parent e1342d2 commit f5b3f96

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

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

+1
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

+4
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

+1-1
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

+4
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)