Skip to content

Commit f184e40

Browse files
committed
Fixes
1 parent 522f633 commit f184e40

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,12 @@ public expect class TestResult
143143
*
144144
* #### Test body failures
145145
*
146-
* If the test body finishes with an exception, then this exception will be thrown at the end of the test. Additionally,
147-
* to prevent child coroutines getting stuck, the whole scope will be cancelled in this case.
146+
* If the test body finishes with an exception, then this exception will be thrown at the end of the test.
148147
*
149148
* #### Reported exceptions
150149
*
151150
* Exceptions reported to the test coroutine scope via [TestCoroutineScope.reportException] will be thrown at the end.
152-
* By default (without passing an explicit [TestExceptionHandler]), this includes all unhandled exceptions.
151+
* By default, unless an explicit [TestExceptionHandler] is passed, this includes all unhandled exceptions.
153152
*
154153
* #### Uncompleted coroutines
155154
*

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class TestCoroutineScheduler: AbstractCoroutineContextElement(TestCorouti
8383
/**
8484
* Runs the next enqueued task, advancing the virtual time to the time of its scheduled awakening.
8585
*/
86-
internal fun tryRunNextTask(): Boolean {
86+
private fun tryRunNextTask(): Boolean {
8787
val event = synchronized(lock) {
8888
val event = events.removeFirstOrNull() ?: return false
8989
if (currentTime > event.time)
@@ -105,7 +105,7 @@ public class TestCoroutineScheduler: AbstractCoroutineContextElement(TestCorouti
105105
*/
106106
@ExperimentalCoroutinesApi
107107
public fun advanceUntilIdle() {
108-
while (!events.isEmpty) {
108+
while (!synchronized(lock) { events.isEmpty }) {
109109
tryRunNextTask()
110110
}
111111
}

0 commit comments

Comments
 (0)