@@ -27,6 +27,7 @@ import kotlin.time.Duration.Companion.milliseconds
27
27
* virtual time as needed (via [advanceUntilIdle]), or run the tasks that are scheduled to run as soon as possible but
28
28
* haven't yet been dispatched (via [runCurrent]).
29
29
*/
30
+ @ExperimentalCoroutinesApi
30
31
public class TestCoroutineScheduler : AbstractCoroutineContextElement (TestCoroutineScheduler ),
31
32
CoroutineContext .Element {
32
33
@@ -112,6 +113,7 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
112
113
* milliseconds by which the execution of this method has advanced the virtual time. If you want to recreate that
113
114
* functionality, query [currentTime] before and after the execution to achieve the same result.
114
115
*/
116
+ @ExperimentalCoroutinesApi
115
117
public fun advanceUntilIdle (): Unit = advanceUntilIdleOr { events.none(TestDispatchEvent <* >::isForeground) }
116
118
117
119
/* *
@@ -127,6 +129,7 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
127
129
/* *
128
130
* Runs the tasks that are scheduled to execute at this moment of virtual time.
129
131
*/
132
+ @ExperimentalCoroutinesApi
130
133
public fun runCurrent () {
131
134
val timeMark = synchronized(lock) { currentTime }
132
135
while (true ) {
@@ -162,6 +165,7 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
162
165
*
163
166
* @throws IllegalArgumentException if passed a negative [delay][delayTime].
164
167
*/
168
+ @ExperimentalCoroutinesApi
165
169
public fun advanceTimeBy (delayTime : Duration ) {
166
170
require(! delayTime.isNegative()) { " Can not advance time by a negative delay: $delayTime " }
167
171
val startingTime = currentTime
@@ -218,6 +222,7 @@ public class TestCoroutineScheduler : AbstractCoroutineContextElement(TestCorout
218
222
/* *
219
223
* Returns the [TimeSource] representation of the virtual time of this scheduler.
220
224
*/
225
+ @ExperimentalCoroutinesApi
221
226
@ExperimentalTime
222
227
public val timeSource: TimeSource = object : AbstractLongTimeSource (DurationUnit .MILLISECONDS ) {
223
228
override fun read (): Long = currentTime
0 commit comments