File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
kotlin-utils/src/commonTest/kotlin/org/modelix/kotlin/utils Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,16 @@ import kotlin.time.Duration.Companion.milliseconds
26
26
27
27
class ContextValueTests {
28
28
29
+ /*
30
+ * Runs multiple suspendable and non-suspendable functions in parallel to ensure they always read their own value
31
+ * and not a value from a different coroutine/thread.
32
+
33
+ * This test starts two coroutines and tries to run into a race-condition. A successful test doesn't proof the
34
+ * correctness, but a failing test proofs its incorrectness. If it ever becomes unstable, meaning it first fails
35
+ * and then succeeds after a second run, this shouldn't be ignored.
36
+ */
29
37
@Test
30
38
fun testIsolation () = runTest {
31
- // run multiple suspendable and non-suspendable functions in parallel to ensure they always read their own value
32
- // and not a value from a different coroutine/thread.
33
-
34
39
val contextValue = ContextValue <String >(" a" )
35
40
assertEquals(" a" , contextValue.getValueOrNull())
36
41
coroutineScope {
You can’t perform that action at this time.
0 commit comments