Skip to content

Commit 9fd86bb

Browse files
committed
Restore the ExperimentalCoroutinesApi markers
1 parent 579ab0f commit 9fd86bb

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

kotlinx-coroutines-test/common/src/TestBuilders.kt

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import kotlin.time.Duration.Companion.seconds
3131
* * Don't nest functions returning a [TestResult].
3232
*/
3333
@Suppress("NO_ACTUAL_FOR_EXPECT")
34+
@ExperimentalCoroutinesApi
3435
public expect class TestResult
3536

3637
/**
@@ -152,6 +153,7 @@ public expect class TestResult
152153
*
153154
* @throws IllegalArgumentException if the [context] is invalid. See the [TestScope] constructor docs for details.
154155
*/
156+
@ExperimentalCoroutinesApi
155157
public fun runTest(
156158
context: CoroutineContext = EmptyCoroutineContext,
157159
timeout: Duration = DEFAULT_TIMEOUT,
@@ -296,6 +298,7 @@ public fun runTest(
296298
/**
297299
* Performs [runTest] on an existing [TestScope]. See the documentation for [runTest] for details.
298300
*/
301+
@ExperimentalCoroutinesApi
299302
public fun TestScope.runTest(
300303
timeout: Duration = DEFAULT_TIMEOUT,
301304
testBody: suspend TestScope.() -> Unit

kotlinx-coroutines-test/common/src/TestCoroutineDispatchers.kt

+1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ private class UnconfinedTestDispatcherImpl(
137137
*
138138
* @see UnconfinedTestDispatcher for a dispatcher that is not confined to any particular thread.
139139
*/
140+
@ExperimentalCoroutinesApi
140141
@Suppress("FunctionName")
141142
public fun StandardTestDispatcher(
142143
scheduler: TestCoroutineScheduler? = null,

kotlinx-coroutines-test/common/src/TestCoroutineScheduler.kt

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import kotlin.time.Duration.Companion.milliseconds
2727
* virtual time as needed (via [advanceUntilIdle]), or run the tasks that are scheduled to run as soon as possible but
2828
* haven't yet been dispatched (via [runCurrent]).
2929
*/
30+
@ExperimentalCoroutinesApi
3031
public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCoroutineScheduler),
3132
CoroutineContext.Element {
3233

@@ -112,6 +113,7 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
112113
* milliseconds by which the execution of this method has advanced the virtual time. If you want to recreate that
113114
* functionality, query [currentTime] before and after the execution to achieve the same result.
114115
*/
116+
@ExperimentalCoroutinesApi
115117
public fun advanceUntilIdle(): Unit = advanceUntilIdleOr { events.none(TestDispatchEvent<*>::isForeground) }
116118

117119
/**
@@ -127,6 +129,7 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
127129
/**
128130
* Runs the tasks that are scheduled to execute at this moment of virtual time.
129131
*/
132+
@ExperimentalCoroutinesApi
130133
public fun runCurrent() {
131134
val timeMark = synchronized(lock) { currentTime }
132135
while (true) {
@@ -162,6 +165,7 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
162165
*
163166
* @throws IllegalArgumentException if passed a negative [delay][delayTime].
164167
*/
168+
@ExperimentalCoroutinesApi
165169
public fun advanceTimeBy(delayTime: Duration) {
166170
require(!delayTime.isNegative()) { "Can not advance time by a negative delay: $delayTime" }
167171
val startingTime = currentTime
@@ -218,6 +222,7 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
218222
/**
219223
* Returns the [TimeSource] representation of the virtual time of this scheduler.
220224
*/
225+
@ExperimentalCoroutinesApi
221226
@ExperimentalTime
222227
public val timeSource: TimeSource = object : AbstractLongTimeSource(DurationUnit.MILLISECONDS) {
223228
override fun read(): Long = currentTime

kotlinx-coroutines-test/common/src/TestDispatcher.kt

+2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ import kotlin.jvm.*
1616
* * [UnconfinedTestDispatcher] is a dispatcher that behaves like [Dispatchers.Unconfined] while allowing to control
1717
* the virtual time.
1818
*/
19+
@ExperimentalCoroutinesApi
1920
public abstract class TestDispatcher internal constructor() : CoroutineDispatcher(), Delay {
2021
/** The scheduler that this dispatcher is linked to. */
22+
@ExperimentalCoroutinesApi
2123
public abstract val scheduler: TestCoroutineScheduler
2224

2325
/** Notifies the dispatcher that it should process a single event marked with [marker] happening at time [time]. */

kotlinx-coroutines-test/common/src/TestScope.kt

+4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ import kotlin.time.*
4040
* paused by default, like [StandardTestDispatcher].
4141
* * No access to the list of unhandled exceptions.
4242
*/
43+
@ExperimentalCoroutinesApi
4344
public sealed interface TestScope : CoroutineScope {
4445
/**
4546
* The delay-skipping scheduler used by the test dispatchers running the code in this scope.
4647
*/
48+
@ExperimentalCoroutinesApi
4749
public val testScheduler: TestCoroutineScheduler
4850

4951
/**
@@ -80,6 +82,7 @@ public sealed interface TestScope : CoroutineScope {
8082
* }
8183
* ```
8284
*/
85+
@ExperimentalCoroutinesApi
8386
public val backgroundScope: CoroutineScope
8487
}
8588

@@ -163,6 +166,7 @@ public val TestScope.testTimeSource: TimeSource get() = testScheduler.timeSource
163166
* @throws IllegalArgumentException if [context] has an [CoroutineExceptionHandler] that is not an
164167
* [UncaughtExceptionCaptor].
165168
*/
169+
@ExperimentalCoroutinesApi
166170
@Suppress("FunctionName")
167171
public fun TestScope(context: CoroutineContext = EmptyCoroutineContext): TestScope {
168172
val ctxWithDispatcher = context.withDelaySkipping()

0 commit comments

Comments
 (0)