Skip to content

Commit 42a345e

Browse files
committed
Comments for tests
1 parent c1a1ce5 commit 42a345e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

kotlinx-coroutines-test/common/test/TestRunTest.kt renamed to kotlinx-coroutines-test/common/test/RunTestTest.kt

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
package kotlinx.coroutines.test
66

77
import kotlinx.coroutines.*
8+
import kotlinx.coroutines.flow.*
89
import kotlin.coroutines.*
910
import kotlin.test.*
1011
import kotlin.time.*
1112

12-
class TestRunTest {
13+
class RunTestTest {
1314

15+
/** Tests that [withContext] that sends work to other threads works in [runTest]. */
1416
@Test
1517
fun testWithContextDispatching() = runTest {
1618
var counter = 0
@@ -20,6 +22,7 @@ class TestRunTest {
2022
assertEquals(counter, 1)
2123
}
2224

25+
/** Tests that joining [GlobalScope.launch] works in [runTest]. */
2326
@Test
2427
fun testJoiningForkedJob() = runTest {
2528
var counter = 0
@@ -30,14 +33,16 @@ class TestRunTest {
3033
assertEquals(counter, 1)
3134
}
3235

36+
/** Tests [suspendCoroutine] not failing [runTest]. */
3337
@Test
34-
fun testSuspendCancellableCoroutine() = runTest {
38+
fun testSuspendCoroutine() = runTest {
3539
val answer = suspendCoroutine<Int> {
3640
it.resume(42)
3741
}
3842
assertEquals(42, answer)
3943
}
4044

45+
/** Tests that [runTest] attempts to detect it being run inside another [runTest] and failing in such scenarios. */
4146
@Test
4247
fun testNestedRunTestForbidden() = runTest {
4348
assertFailsWith<IllegalStateException> {

kotlinx-coroutines-test/jvm/test/MultithreadingTest.kt

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class MultithreadingTest {
8888
}
8989
}
9090

91+
/** Tests that resuming the coroutine of [runTest] asynchronously in reasonable time succeeds. */
9192
@Test
9293
fun testResumingFromAnotherThread() = runTest {
9394
suspendCancellableCoroutine<Unit> { cont ->

0 commit comments

Comments
 (0)