1
1
/*
2
2
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
3
*/
4
+ @file:Suppress(" DEPRECATION" )
4
5
5
6
package kotlinx.coroutines.test
6
7
@@ -100,7 +101,10 @@ public interface DelayController {
100
101
* This is useful when testing functions that start a coroutine. By pausing the dispatcher assertions or
101
102
* setup may be done between the time the coroutine is created and started.
102
103
*/
103
- @ExperimentalCoroutinesApi
104
+ @Deprecated(
105
+ " Please use a dispatcher that is paused by default, like `StandardTestDispatcher`." ,
106
+ level = DeprecationLevel .WARNING
107
+ )
104
108
public suspend fun pauseDispatcher (block : suspend () -> Unit )
105
109
106
110
/* *
@@ -109,7 +113,10 @@ public interface DelayController {
109
113
* When paused, the dispatcher will not execute any coroutines automatically, and you must call [runCurrent] or
110
114
* [advanceTimeBy], or [advanceUntilIdle] to execute coroutines.
111
115
*/
112
- @ExperimentalCoroutinesApi
116
+ @Deprecated(
117
+ " Please use a dispatcher that is paused by default, like `StandardTestDispatcher`." ,
118
+ level = DeprecationLevel .WARNING
119
+ )
113
120
public fun pauseDispatcher ()
114
121
115
122
/* *
@@ -119,12 +126,15 @@ public interface DelayController {
119
126
* time and execute coroutines scheduled in the future use, one of [advanceTimeBy],
120
127
* or [advanceUntilIdle].
121
128
*/
122
- @ExperimentalCoroutinesApi
129
+ @Deprecated(
130
+ " Please use a dispatcher that is paused by default, like `StandardTestDispatcher`." ,
131
+ level = DeprecationLevel .WARNING
132
+ )
123
133
public fun resumeDispatcher ()
124
134
}
125
135
126
136
internal interface SchedulerAsDelayController : DelayController {
127
- public val scheduler: TestCoroutineScheduler
137
+ val scheduler: TestCoroutineScheduler
128
138
129
139
/* * @suppress */
130
140
@Deprecated(" This property delegates to the test scheduler, which may cause confusing behavior unless made explicit." ,
@@ -167,7 +177,7 @@ internal interface SchedulerAsDelayController: DelayController {
167
177
scheduler.runCurrent()
168
178
if (! scheduler.isIdle()) {
169
179
throw UncompletedCoroutinesError (
170
- " Unfinished coroutines during teardown . Ensure all coroutines are" +
180
+ " Unfinished coroutines during tear-down . Ensure all coroutines are" +
171
181
" completed or cancelled by your test."
172
182
)
173
183
}
0 commit comments