Skip to content

Commit 579ab0f

Browse files
committed
Improve the deprecation notices
1 parent 4417a41 commit 579ab0f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ public fun runTest(
278278
@Deprecated(
279279
"Define a total timeout for the whole test instead of using dispatchTimeoutMs. " +
280280
"Warning: the proposed replacement is not identical as it uses 'dispatchTimeoutMs' as the timeout for the whole test!",
281-
ReplaceWith("runTest(context, timeout = with(kotlin.time.Duration.Companion) { dispatchTimeoutMs.milliseconds }, testBody)"),
281+
ReplaceWith("runTest(context, timeout = dispatchTimeoutMs.milliseconds, testBody)",
282+
"kotlin.time.Duration.Companion.milliseconds"),
282283
DeprecationLevel.WARNING
283284
)
284285
public fun runTest(
@@ -387,7 +388,8 @@ public fun TestScope.runTest(
387388
@Deprecated(
388389
"Define a total timeout for the whole test instead of using dispatchTimeoutMs. " +
389390
"Warning: the proposed replacement is not identical as it uses 'dispatchTimeoutMs' as the timeout for the whole test!",
390-
ReplaceWith("this.runTest(timeout = with(kotlin.time.Duration.Companion) { dispatchTimeoutMs.milliseconds }, testBody)"),
391+
ReplaceWith("this.runTest(timeout = dispatchTimeoutMs.milliseconds, testBody)",
392+
"kotlin.time.Duration.Companion.milliseconds"),
391393
DeprecationLevel.WARNING
392394
)
393395
public fun TestScope.runTest(

kotlinx-coroutines-test/common/test/RunTestTest.kt

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import kotlin.test.*
1212
import kotlin.time.*
1313
import kotlin.time.Duration.Companion.milliseconds
1414

15-
@OptIn(ExperimentalTime::class)
1615
class RunTestTest {
1716

1817
/** Tests that [withContext] that sends work to other threads works in [runTest]. */

0 commit comments

Comments
 (0)