@@ -18,7 +18,7 @@ class WithTimeoutDurationTest : TestBase() {
18
18
@Test
19
19
fun testBasicNoSuspend () = runTest {
20
20
expect(1 )
21
- val result = withTimeout(10 .seconds) {
21
+ val result = kotlinx.coroutines.time. withTimeout(10 .seconds) {
22
22
expect(2 )
23
23
" OK"
24
24
}
@@ -32,7 +32,7 @@ class WithTimeoutDurationTest : TestBase() {
32
32
@Test
33
33
fun testBasicSuspend () = runTest {
34
34
expect(1 )
35
- val result = withTimeout(10 .seconds) {
35
+ val result = kotlinx.coroutines.time. withTimeout(10 .seconds) {
36
36
expect(2 )
37
37
yield ()
38
38
expect(3 )
@@ -55,7 +55,7 @@ class WithTimeoutDurationTest : TestBase() {
55
55
}
56
56
expect(2 )
57
57
// test that it does not yield to the above job when started
58
- val result = withTimeout(1 .seconds) {
58
+ val result = kotlinx.coroutines.time. withTimeout(1 .seconds) {
59
59
expect(3 )
60
60
yield () // yield only now
61
61
expect(5 )
@@ -75,7 +75,7 @@ class WithTimeoutDurationTest : TestBase() {
75
75
fun testYieldBlockingWithTimeout () = runTest(
76
76
expected = { it is CancellationException }
77
77
) {
78
- withTimeout(100 .milliseconds) {
78
+ kotlinx.coroutines.time. withTimeout(100 .milliseconds) {
79
79
while (true ) {
80
80
yield ()
81
81
}
@@ -88,7 +88,7 @@ class WithTimeoutDurationTest : TestBase() {
88
88
@Test
89
89
fun testWithTimeoutChildWait () = runTest {
90
90
expect(1 )
91
- withTimeout(100 .milliseconds) {
91
+ kotlinx.coroutines.time. withTimeout(100 .milliseconds) {
92
92
expect(2 )
93
93
// launch child with timeout
94
94
launch {
@@ -103,7 +103,7 @@ class WithTimeoutDurationTest : TestBase() {
103
103
@Test
104
104
fun testBadClass () = runTest {
105
105
val bad = BadClass ()
106
- val result = withTimeout(100 .milliseconds) {
106
+ val result = kotlinx.coroutines.time. withTimeout(100 .milliseconds) {
107
107
bad
108
108
}
109
109
assertSame(bad, result)
@@ -119,7 +119,7 @@ class WithTimeoutDurationTest : TestBase() {
119
119
fun testExceptionOnTimeout () = runTest {
120
120
expect(1 )
121
121
try {
122
- withTimeout(100 .milliseconds) {
122
+ kotlinx.coroutines.time. withTimeout(100 .milliseconds) {
123
123
expect(2 )
124
124
delay(1000 .milliseconds)
125
125
expectUnreached()
@@ -136,7 +136,7 @@ class WithTimeoutDurationTest : TestBase() {
136
136
expected = { it is CancellationException }
137
137
) {
138
138
expect(1 )
139
- withTimeout(100 .milliseconds) {
139
+ kotlinx.coroutines.time. withTimeout(100 .milliseconds) {
140
140
expect(2 )
141
141
try {
142
142
delay(1000 .milliseconds)
@@ -152,7 +152,7 @@ class WithTimeoutDurationTest : TestBase() {
152
152
fun testSuppressExceptionWithAnotherException () = runTest {
153
153
expect(1 )
154
154
try {
155
- withTimeout(100 .milliseconds) {
155
+ kotlinx.coroutines.time. withTimeout(100 .milliseconds) {
156
156
expect(2 )
157
157
try {
158
158
delay(1000 .milliseconds)
@@ -173,7 +173,7 @@ class WithTimeoutDurationTest : TestBase() {
173
173
fun testNegativeTimeout () = runTest {
174
174
expect(1 )
175
175
try {
176
- withTimeout(- 1 .milliseconds) {
176
+ kotlinx.coroutines.time. withTimeout(- 1 .milliseconds) {
177
177
expectUnreached()
178
178
" OK"
179
179
}
@@ -188,7 +188,7 @@ class WithTimeoutDurationTest : TestBase() {
188
188
expect(1 )
189
189
try {
190
190
expect(2 )
191
- withTimeout(1 .seconds) {
191
+ kotlinx.coroutines.time. withTimeout(1 .seconds) {
192
192
expect(3 )
193
193
throw TestException ()
194
194
}
@@ -201,7 +201,7 @@ class WithTimeoutDurationTest : TestBase() {
201
201
@Test
202
202
fun testIncompleteWithTimeoutState () = runTest {
203
203
lateinit var timeoutJob: Job
204
- val handle = withTimeout(Duration .INFINITE ) {
204
+ val handle = kotlinx.coroutines.time. withTimeout(Duration .INFINITE ) {
205
205
timeoutJob = coroutineContext[Job ]!!
206
206
timeoutJob.invokeOnCompletion { }
207
207
}
0 commit comments