Skip to content

Commit dee15d8

Browse files
committed
Enable new MM for kotlinx-coroutines-test
1 parent c1869f5 commit dee15d8

File tree

7 files changed

+11
-35
lines changed

7 files changed

+11
-35
lines changed

kotlinx-coroutines-test/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.plugin.mpp.*
2+
13
/*
24
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
35
*/
@@ -10,4 +12,10 @@ val experimentalAnnotations = listOf(
1012

1113
kotlin {
1214
sourceSets.all { configureMultiplatform() }
15+
16+
targets.withType(KotlinNativeTargetWithTests::class.java).configureEach {
17+
val tests = binaries.getTest("DEBUG")
18+
tests.optimized = true
19+
tests.binaryOptions["memoryModel"] = "experimental"
20+
}
1321
}

kotlinx-coroutines-test/common/test/RunTestTest.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class RunTestTest {
7171

7272
/** Tests that a dispatch timeout of `0` will fail the test if there are some dispatches outside the scheduler. */
7373
@Test
74-
@NoNative // TODO: timeout leads to `Cannot execute task because event loop was shut down` on Native
7574
fun testRunTestWithZeroTimeoutWithUncontrolledDispatches() = testResultMap({ fn ->
7675
assertFailsWith<UncompletedCoroutinesError> { fn() }
7776
}) {
@@ -86,7 +85,6 @@ class RunTestTest {
8685

8786
/** Tests that too low of a dispatch timeout causes crashes. */
8887
@Test
89-
@NoNative // TODO: timeout leads to `Cannot execute task because event loop was shut down` on Native
9088
fun testRunTestWithSmallTimeout() = testResultMap({ fn ->
9189
assertFailsWith<UncompletedCoroutinesError> { fn() }
9290
}) {
@@ -112,7 +110,7 @@ class RunTestTest {
112110
it()
113111
fail("unreached")
114112
} catch (e: UncompletedCoroutinesError) {
115-
assertTrue((e.message ?: "").contains(name1))
113+
assertContains(e.message ?: "", name1)
116114
assertFalse((e.message ?: "").contains(name2))
117115
}
118116
}) {
@@ -162,7 +160,6 @@ class RunTestTest {
162160

163161
/** Tests uncaught exceptions being suppressed by the dispatch timeout error. */
164162
@Test
165-
@NoNative // TODO: timeout leads to `Cannot execute task because event loop was shut down` on Native
166163
fun testRunTestTimingOutAndThrowing() = testResultMap({ fn ->
167164
try {
168165
fn()

kotlinx-coroutines-test/common/test/StandardTestDispatcherTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class StandardTestDispatcherTest: OrderedExecutionTestBase() {
6464

6565
/** Tests that the [TestCoroutineScheduler] used for [Dispatchers.Main] gets used by default. */
6666
@Test
67-
@NoNative
6867
fun testSchedulerReuse() {
6968
val dispatcher1 = StandardTestDispatcher()
7069
Dispatchers.setMain(dispatcher1)
@@ -76,4 +75,4 @@ class StandardTestDispatcherTest: OrderedExecutionTestBase() {
7675
}
7776
}
7877

79-
}
78+
}

kotlinx-coroutines-test/common/test/TestDispatchersTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import kotlinx.coroutines.test.internal.*
88
import kotlin.coroutines.*
99
import kotlin.test.*
1010

11-
@NoNative
1211
class TestDispatchersTest: OrderedExecutionTestBase() {
1312

1413
@BeforeTest

kotlinx-coroutines-test/common/test/TestScopeTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class TestScopeTest {
5454

5555
/** Part of [testCreateProvidesScheduler], disabled for Native */
5656
@Test
57-
@NoNative
5857
fun testCreateReusesScheduler() {
5958
// Reuses the scheduler of `Dispatchers.Main`
6059
run {

kotlinx-coroutines-test/common/test/UnconfinedTestDispatcherTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ class UnconfinedTestDispatcherTest {
153153

154154
/** Tests that the [TestCoroutineScheduler] used for [Dispatchers.Main] gets used by default. */
155155
@Test
156-
@NoNative
157156
fun testSchedulerReuse() {
158157
val dispatcher1 = StandardTestDispatcher()
159158
Dispatchers.setMain(dispatcher1)
@@ -165,4 +164,4 @@ class UnconfinedTestDispatcherTest {
165164
}
166165
}
167166

168-
}
167+
}

kotlinx-coroutines-test/native/test/FailingTests.kt

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)