Skip to content

Commit bf03c48

Browse files
authored
Remove some ExperimentalCoroutinesApi markers in the test module (#3622)
1 parent 7014961 commit bf03c48

File tree

5 files changed

+1
-16
lines changed

5 files changed

+1
-16
lines changed

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

-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import kotlinx.coroutines.internal.*
3232
* * Don't nest functions returning a [TestResult].
3333
*/
3434
@Suppress("NO_ACTUAL_FOR_EXPECT")
35-
@ExperimentalCoroutinesApi
3635
public expect class TestResult
3736

3837
/**
@@ -156,7 +155,6 @@ public expect class TestResult
156155
*
157156
* @throws IllegalArgumentException if the [context] is invalid. See the [TestScope] constructor docs for details.
158157
*/
159-
@ExperimentalCoroutinesApi
160158
public fun runTest(
161159
context: CoroutineContext = EmptyCoroutineContext,
162160
timeout: Duration = DEFAULT_TIMEOUT,
@@ -302,7 +300,6 @@ public fun runTest(
302300
/**
303301
* Performs [runTest] on an existing [TestScope]. See the documentation for [runTest] for details.
304302
*/
305-
@ExperimentalCoroutinesApi
306303
public fun TestScope.runTest(
307304
timeout: Duration = DEFAULT_TIMEOUT,
308305
testBody: suspend TestScope.() -> Unit

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

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

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

+1-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ 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
3130
public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCoroutineScheduler),
3231
CoroutineContext.Element {
3332

@@ -109,11 +108,10 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
109108
* Runs the enqueued tasks in the specified order, advancing the virtual time as needed until there are no more
110109
* tasks associated with the dispatchers linked to this scheduler.
111110
*
112-
* A breaking change from [TestCoroutineDispatcher.advanceTimeBy] is that it no longer returns the total number of
111+
* A breaking change from `TestCoroutineDispatcher.advanceTimeBy` is that it no longer returns the total number of
113112
* milliseconds by which the execution of this method has advanced the virtual time. If you want to recreate that
114113
* functionality, query [currentTime] before and after the execution to achieve the same result.
115114
*/
116-
@ExperimentalCoroutinesApi
117115
public fun advanceUntilIdle(): Unit = advanceUntilIdleOr { events.none(TestDispatchEvent<*>::isForeground) }
118116

119117
/**
@@ -129,7 +127,6 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
129127
/**
130128
* Runs the tasks that are scheduled to execute at this moment of virtual time.
131129
*/
132-
@ExperimentalCoroutinesApi
133130
public fun runCurrent() {
134131
val timeMark = synchronized(lock) { currentTime }
135132
while (true) {
@@ -165,7 +162,6 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
165162
*
166163
* @throws IllegalArgumentException if passed a negative [delay][delayTime].
167164
*/
168-
@ExperimentalCoroutinesApi
169165
public fun advanceTimeBy(delayTime: Duration) {
170166
require(!delayTime.isNegative()) { "Can not advance time by a negative delay: $delayTime" }
171167
val startingTime = currentTime
@@ -227,7 +223,6 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
227223
/**
228224
* Returns the [TimeSource] representation of the virtual time of this scheduler.
229225
*/
230-
@ExperimentalCoroutinesApi
231226
@ExperimentalTime
232227
public val timeSource: TimeSource = object : AbstractLongTimeSource(DurationUnit.MILLISECONDS) {
233228
override fun read(): Long = currentTime

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

-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ import kotlin.time.*
1717
* * [UnconfinedTestDispatcher] is a dispatcher that behaves like [Dispatchers.Unconfined] while allowing to control
1818
* the virtual time.
1919
*/
20-
@ExperimentalCoroutinesApi
2120
@Suppress("INVISIBLE_REFERENCE")
2221
public abstract class TestDispatcher internal constructor() : CoroutineDispatcher(), Delay, DelayWithTimeoutDiagnostics {
2322
/** The scheduler that this dispatcher is linked to. */
24-
@ExperimentalCoroutinesApi
2523
public abstract val scheduler: TestCoroutineScheduler
2624

2725
/** 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,12 +40,10 @@ import kotlin.time.*
4040
* paused by default, like [StandardTestDispatcher].
4141
* * No access to the list of unhandled exceptions.
4242
*/
43-
@ExperimentalCoroutinesApi
4443
public sealed interface TestScope : CoroutineScope {
4544
/**
4645
* The delay-skipping scheduler used by the test dispatchers running the code in this scope.
4746
*/
48-
@ExperimentalCoroutinesApi
4947
public val testScheduler: TestCoroutineScheduler
5048

5149
/**
@@ -82,7 +80,6 @@ public sealed interface TestScope : CoroutineScope {
8280
* }
8381
* ```
8482
*/
85-
@ExperimentalCoroutinesApi
8683
public val backgroundScope: CoroutineScope
8784
}
8885

@@ -166,7 +163,6 @@ public val TestScope.testTimeSource: TimeSource get() = testScheduler.timeSource
166163
* @throws IllegalArgumentException if [context] has an [CoroutineExceptionHandler] that is not an
167164
* [UncaughtExceptionCaptor].
168165
*/
169-
@ExperimentalCoroutinesApi
170166
@Suppress("FunctionName")
171167
public fun TestScope(context: CoroutineContext = EmptyCoroutineContext): TestScope {
172168
val ctxWithDispatcher = context.withDelaySkipping()

0 commit comments

Comments
 (0)