From ae827545c90d3b3dfd298ca55ac37d979a905099 Mon Sep 17 00:00:00 2001 From: Dmitry Khalanskiy Date: Wed, 17 Nov 2021 11:10:20 +0300 Subject: [PATCH] Fix build on Native --- .../common/test/StandardTestDispatcherTest.kt | 1 + kotlinx-coroutines-test/common/test/TestDispatchersTest.kt | 3 ++- kotlinx-coroutines-test/common/test/TestScopeTest.kt | 6 ++++++ .../common/test/UnconfinedTestDispatcherTest.kt | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kotlinx-coroutines-test/common/test/StandardTestDispatcherTest.kt b/kotlinx-coroutines-test/common/test/StandardTestDispatcherTest.kt index e9b2e179da..d66be9bdb6 100644 --- a/kotlinx-coroutines-test/common/test/StandardTestDispatcherTest.kt +++ b/kotlinx-coroutines-test/common/test/StandardTestDispatcherTest.kt @@ -64,6 +64,7 @@ class StandardTestDispatcherTest: OrderedExecutionTestBase() { /** Tests that the [TestCoroutineScheduler] used for [Dispatchers.Main] gets used by default. */ @Test + @NoNative fun testSchedulerReuse() { val dispatcher1 = StandardTestDispatcher() Dispatchers.setMain(dispatcher1) diff --git a/kotlinx-coroutines-test/common/test/TestDispatchersTest.kt b/kotlinx-coroutines-test/common/test/TestDispatchersTest.kt index 5372b9fe5e..66a6c24e8f 100644 --- a/kotlinx-coroutines-test/common/test/TestDispatchersTest.kt +++ b/kotlinx-coroutines-test/common/test/TestDispatchersTest.kt @@ -8,6 +8,7 @@ import kotlinx.coroutines.test.internal.* import kotlin.coroutines.* import kotlin.test.* +@NoNative class TestDispatchersTest: OrderedExecutionTestBase() { @BeforeTest @@ -21,8 +22,8 @@ class TestDispatchersTest: OrderedExecutionTestBase() { } /** Tests that asynchronous execution of tests does not happen concurrently with [AfterTest]. */ - @NoJs @Test + @NoJs fun testMainMocking() = runTest { val mainAtStart = TestMainDispatcher.currentTestDispatcher assertNotNull(mainAtStart) diff --git a/kotlinx-coroutines-test/common/test/TestScopeTest.kt b/kotlinx-coroutines-test/common/test/TestScopeTest.kt index 743dde3ca7..7031056f11 100644 --- a/kotlinx-coroutines-test/common/test/TestScopeTest.kt +++ b/kotlinx-coroutines-test/common/test/TestScopeTest.kt @@ -48,6 +48,12 @@ class TestScopeTest { assertSame(scheduler, scope.coroutineContext[TestCoroutineScheduler]) assertSame(dispatcher, scope.coroutineContext[ContinuationInterceptor]) } + } + + /** Part of [testCreateProvidesScheduler], disabled for Native */ + @Test + @NoNative + fun testCreateReusesScheduler() { // Reuses the scheduler of `Dispatchers.Main` run { val scheduler = TestCoroutineScheduler() diff --git a/kotlinx-coroutines-test/common/test/UnconfinedTestDispatcherTest.kt b/kotlinx-coroutines-test/common/test/UnconfinedTestDispatcherTest.kt index 719698e843..ee63e6d118 100644 --- a/kotlinx-coroutines-test/common/test/UnconfinedTestDispatcherTest.kt +++ b/kotlinx-coroutines-test/common/test/UnconfinedTestDispatcherTest.kt @@ -153,6 +153,7 @@ class UnconfinedTestDispatcherTest { /** Tests that the [TestCoroutineScheduler] used for [Dispatchers.Main] gets used by default. */ @Test + @NoNative fun testSchedulerReuse() { val dispatcher1 = StandardTestDispatcher() Dispatchers.setMain(dispatcher1)