Skip to content

Commit 3cfdf7a

Browse files
committed
Review fixes
1 parent 57497ec commit 3cfdf7a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ internal class TestScopeImpl(context: CoroutineContext) :
251251
/** Called at the end of the test. May only be called once. Returns the list of caught unhandled exceptions. */
252252
fun leave(): List<Throwable> = synchronized(lock) {
253253
check(entered && !finished)
254+
/** After [finished] becomes `true`, it is no longer valid to have [reportException] as the callback. */
255+
ExceptionCollector.removeOnExceptionCallback(lock)
254256
finished = true
255257
uncaughtExceptions
256258
}

kotlinx-coroutines-test/jvm/src/module-info.java

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import kotlinx.coroutines.CoroutineExceptionHandler;
12
import kotlinx.coroutines.internal.MainDispatcherFactory;
3+
import kotlinx.coroutines.test.internal.ExceptionCollectorAsService;
24
import kotlinx.coroutines.test.internal.TestMainDispatcherFactory;
35

46
module kotlinx.coroutines.test {
@@ -8,4 +10,5 @@
810
exports kotlinx.coroutines.test;
911

1012
provides MainDispatcherFactory with TestMainDispatcherFactory;
13+
provides CoroutineExceptionHandler with ExceptionCollectorAsService;
1114
}

0 commit comments

Comments
 (0)