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
@@ -102,7 +103,10 @@ public interface DelayController {
102
103
* This is useful when testing functions that start a coroutine. By pausing the dispatcher assertions or
103
104
* setup may be done between the time the coroutine is created and started.
104
105
*/
105
- @ExperimentalCoroutinesApi
106
+ @Deprecated(
107
+ " Please use a dispatcher that is paused by default, like `StandardTestDispatcher`." ,
108
+ level = DeprecationLevel .WARNING
109
+ )
106
110
public suspend fun pauseDispatcher (block : suspend () -> Unit )
107
111
108
112
/* *
@@ -111,7 +115,10 @@ public interface DelayController {
111
115
* When paused, the dispatcher will not execute any coroutines automatically, and you must call [runCurrent] or
112
116
* [advanceTimeBy], or [advanceUntilIdle] to execute coroutines.
113
117
*/
114
- @ExperimentalCoroutinesApi
118
+ @Deprecated(
119
+ " Please use a dispatcher that is paused by default, like `StandardTestDispatcher`." ,
120
+ level = DeprecationLevel .WARNING
121
+ )
115
122
public fun pauseDispatcher ()
116
123
117
124
/* *
@@ -121,12 +128,15 @@ public interface DelayController {
121
128
* time and execute coroutines scheduled in the future use, one of [advanceTimeBy],
122
129
* or [advanceUntilIdle].
123
130
*/
124
- @ExperimentalCoroutinesApi
131
+ @Deprecated(
132
+ " Please use a dispatcher that is paused by default, like `StandardTestDispatcher`." ,
133
+ level = DeprecationLevel .WARNING
134
+ )
125
135
public fun resumeDispatcher ()
126
136
}
127
137
128
138
internal interface SchedulerAsDelayController : DelayController {
129
- public val scheduler: TestCoroutineScheduler
139
+ val scheduler: TestCoroutineScheduler
130
140
131
141
/* * @suppress */
132
142
@Deprecated(
@@ -178,7 +188,7 @@ internal interface SchedulerAsDelayController : DelayController {
178
188
scheduler.runCurrent()
179
189
if (! scheduler.isIdle()) {
180
190
throw UncompletedCoroutinesError (
181
- " Unfinished coroutines during teardown . Ensure all coroutines are" +
191
+ " Unfinished coroutines during tear-down . Ensure all coroutines are" +
182
192
" completed or cancelled by your test."
183
193
)
184
194
}
0 commit comments