Skip to content

Commit a201397

Browse files
committed
second level header - remove code
1 parent 9f5383b commit a201397

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

docs/topics/cancellation-and-timeouts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ main: I'm tired of waiting!
189189
main: Now I can quit.
190190
-->
191191

192-
## Closing resources with `finally`
192+
## Closing resources with finally
193193

194194
Cancellable suspending functions throw [CancellationException] on cancellation, which can be handled in
195195
the usual way. For example, the `try {...} finally {...}` expression and Kotlin's `use` function execute their

kotlinx-coroutines-test/MIGRATION.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In version 1.6.0, the API of the test module changed significantly.
44
This is a guide for gradually adapting the existing test code to the new API.
55
This guide is written step-by-step; the idea is to separate the migration into several sets of small changes.
66

7-
## Remove custom `UncaughtExceptionCaptor`, `DelayController`, and `TestCoroutineScope` implementations
7+
## Remove custom UncaughtExceptionCaptor, DelayController, and TestCoroutineScope implementations
88

99
We couldn't find any code that defined new implementations of these interfaces, so they are deprecated. It's likely that
1010
you don't need to do anything for this section.
@@ -61,7 +61,7 @@ So, there could be two reasons for defining a custom implementation:
6161
* Using without `runBlockingTest`. In this case, you don't even need to implement `TestCoroutineScope`: nothing else
6262
accepts a `TestCoroutineScope` specifically as an argument.
6363

64-
## Remove usages of `TestCoroutineExceptionHandler` and `TestCoroutineScope.uncaughtExceptions`
64+
## Remove usages of TestCoroutineExceptionHandler and TestCoroutineScope.uncaughtExceptions
6565

6666
It is already illegal to use a `TestCoroutineScope` without performing `cleanupTestCoroutines`, so the valid uses of
6767
`TestCoroutineExceptionHandler` include:
@@ -93,13 +93,13 @@ fun testFoo() = runTest {
9393
}
9494
```
9595

96-
## Auto-replace `TestCoroutineScope` constructor function with `createTestCoroutineScope`
96+
## Auto-replace TestCoroutineScope constructor function with createTestCoroutineScope
9797

9898
This should not break anything, as `TestCoroutineScope` is now defined in terms of `createTestCoroutineScope`.
9999
If it does break something, it means that you already supplied a `TestCoroutineScheduler` to some scope; in this case,
100100
also pass this scheduler as the argument to the dispatcher.
101101

102-
## Replace usages of `pauseDispatcher` and `resumeDispatcher` with a `StandardTestDispatcher`
102+
## Replace usages of pauseDispatcher and resumeDispatcher with a StandardTestDispatcher
103103

104104
* In places where `pauseDispatcher` in its block form is called, replace it with a call to
105105
`withContext(StandardTestDispatcher(testScheduler))`
@@ -120,7 +120,7 @@ also pass this scheduler as the argument to the dispatcher.
120120
`StandardTestDispatcher` (where dispatches are needed) and `UnconfinedTestDispatcher` (where it isn't important where
121121
execution happens).
122122

123-
## Replace `advanceTimeBy(n)` with `advanceTimeBy(n); runCurrent()`
123+
## Replace advanceTimeBy(n) with advanceTimeBy(n); runCurrent()
124124

125125
For `TestCoroutineScope` and `DelayController`, the `advanceTimeBy` method is deprecated.
126126
It is not deprecated for `TestCoroutineScheduler` and `TestScope`, but has a different meaning: it does not run the
@@ -131,7 +131,7 @@ There is an automatic replacement for this deprecation, which produces correct b
131131
Alternatively, you can wait until replacing `TestCoroutineScope` with `TestScope`: it's possible that you will not
132132
encounter this edge case.
133133

134-
## Replace `runBlockingTest` with `runTest(UnconfinedTestDispatcher())`
134+
## Replace runBlockingTest with runTest(UnconfinedTestDispatcher())
135135

136136
This is a major change, affecting many things, and can be done in parallel with replacing `TestCoroutineScope` with
137137
`TestScope`.
@@ -329,7 +329,7 @@ There is a `runTestWithLegacyScope` method that allows migrating from `runBlocki
329329
from `TestCoroutineScope` to `TestScope`, if exactly the `TestCoroutineScope` needs to be passed somewhere else and
330330
`TestScope` will not suffice.
331331

332-
## Replace `TestCoroutineScope.cleanupTestCoroutines` with `runTest`
332+
## Replace TestCoroutineScope.cleanupTestCoroutines with runTest
333333

334334
Likely can be done together with the next step.
335335

@@ -363,7 +363,7 @@ fun runTestAndCleanup(body: TestScope.() -> Unit) = runTest {
363363
}
364364
```
365365

366-
## Replace `runBlockingTest` with `runBlockingTestOnTestScope`, `createTestCoroutineScope` with `TestScope`
366+
## Replace runBlockingTest with runBlockingTestOnTestScope, createTestCoroutineScope with TestScope
367367

368368
Also, replace `runTestWithLegacyScope` with just `runTest`.
369369
All of this can be done in parallel with replacing `runBlockingTest` with `runTest`.
@@ -379,13 +379,13 @@ handle cancelled tasks differently: if there are *cancelled* jobs pending at the
379379
Of all the methods supported by `TestCoroutineScope`, only `cleanupTestCoroutines` is not provided on `TestScope`,
380380
and its usages should have been removed during the previous step.
381381

382-
## Replace `runBlocking` with `runTest`
382+
## Replace runBlocking with runTest
383383

384384
Now that `runTest` works properly with asynchronous completions, `runBlocking` is only occasionally useful.
385385
As is, most uses of `runBlocking` in tests come from the need to interact with dispatchers that execute on other
386386
threads, like `Dispatchers.IO` or `Dispatchers.Default`.
387387

388-
## Replace `TestCoroutineDispatcher` with `UnconfinedTestDispatcher` and `StandardTestDispatcher`
388+
## Replace TestCoroutineDispatcher with UnconfinedTestDispatcher and StandardTestDispatcher
389389

390390
`TestCoroutineDispatcher` is a dispatcher with two modes:
391391
* ("unpaused") Almost (but not quite) unconfined, with the ability to eagerly enter `launch` and `async` blocks.

kotlinx-coroutines-test/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ suspend fun foo() {
159159
}
160160
```
161161

162-
## `launch` and `async`
162+
## launch and async
163163

164164
The coroutine dispatcher used for tests is single-threaded, meaning that the child coroutines of the [runTest] block
165165
will run on the thread that started the test, and will never run in parallel.
@@ -323,7 +323,7 @@ fun testExampleBackgroundJob() = runTest {
323323
}
324324
```
325325

326-
## Eagerly entering `launch` and `async` blocks
326+
## Eagerly entering launch and async blocks
327327

328328
Some tests only test functionality and don't particularly care about the precise order in which coroutines are
329329
dispatched.

0 commit comments

Comments
 (0)