Skip to content

Commit 4fc0a11

Browse files
qwwdfsadelizarov
authored andcommitted
Add test which indicates problem with supervision
1 parent 60fd580 commit 4fc0a11

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

common/kotlinx-coroutines-core-common/test/SupervisorTest.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,26 @@ class SupervisorTest : TestBase() {
106106
}
107107
}
108108

109+
@Test
110+
fun testSupervisorFlaw() = runTest {
111+
try {
112+
supervisorScope {
113+
expect(1)
114+
launch {
115+
// Test exception from supervisor is handled by launch though it clearly will be rethtown by supervisorScope{}
116+
expect(2)
117+
delay(Long.MAX_VALUE)
118+
}
119+
120+
yield()
121+
expect(3)
122+
throw TestException1()
123+
}
124+
} catch (e: TestException1) {
125+
finish(4)
126+
}
127+
}
128+
109129
@Test
110130
fun testSupervisorWithParentCancelNormally() {
111131
val parent = Job()

0 commit comments

Comments
 (0)