From 81baf9cf430c729adb8901e6a548638942bd697e Mon Sep 17 00:00:00 2001 From: Dmitry Khalanskiy <52952525+dkhalanskyjb@users.noreply.github.com> Date: Tue, 14 Mar 2023 14:16:19 +0300 Subject: [PATCH] Preserve binary compatibility with `TestScope.runTest(Long)` (#3676) Fixes #3673 --- .../api/kotlinx-coroutines-test.api | 1 + kotlinx-coroutines-test/common/src/TestBuilders.kt | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/kotlinx-coroutines-test/api/kotlinx-coroutines-test.api b/kotlinx-coroutines-test/api/kotlinx-coroutines-test.api index bcee73e12e..00d9fb659e 100644 --- a/kotlinx-coroutines-test/api/kotlinx-coroutines-test.api +++ b/kotlinx-coroutines-test/api/kotlinx-coroutines-test.api @@ -22,6 +22,7 @@ public final class kotlinx/coroutines/test/TestBuildersKt { public static final fun runTest (Lkotlinx/coroutines/test/TestScope;JLkotlin/jvm/functions/Function2;)V public static synthetic fun runTest$default (Lkotlin/coroutines/CoroutineContext;JLkotlin/jvm/functions/Function2;ILjava/lang/Object;)V public static synthetic fun runTest$default (Lkotlinx/coroutines/test/TestCoroutineScope;JLkotlin/jvm/functions/Function2;ILjava/lang/Object;)V + public static final synthetic fun runTest$default (Lkotlinx/coroutines/test/TestScope;Ljava/lang/Long;Lkotlin/jvm/functions/Function2;Ljava/lang/Integer;Ljava/lang/Object;)V public static final fun runTest-8Mi8wO0 (Lkotlin/coroutines/CoroutineContext;JLkotlin/jvm/functions/Function2;)V public static final fun runTest-8Mi8wO0 (Lkotlinx/coroutines/test/TestScope;JLkotlin/jvm/functions/Function2;)V public static synthetic fun runTest-8Mi8wO0$default (Lkotlin/coroutines/CoroutineContext;JLkotlin/jvm/functions/Function2;ILjava/lang/Object;)V diff --git a/kotlinx-coroutines-test/common/src/TestBuilders.kt b/kotlinx-coroutines-test/common/src/TestBuilders.kt index 15cd1fba4a..8ae075a706 100644 --- a/kotlinx-coroutines-test/common/src/TestBuilders.kt +++ b/kotlinx-coroutines-test/common/src/TestBuilders.kt @@ -570,3 +570,16 @@ internal fun throwAll(head: Throwable?, other: List) { } internal expect fun dumpCoroutines() + +@Deprecated( + "This is for binary compatibility with the `runTest` overload that existed at some point", + level = DeprecationLevel.HIDDEN +) +@JvmName("runTest\$default") +@Suppress("DEPRECATION", "UNUSED_PARAMETER") +public fun TestScope.runTestLegacy( + dispatchTimeoutMs: Long?, + testBody: suspend TestScope.() -> Unit, + unused1: Int?, + unused2: Any?, +): TestResult = runTest(dispatchTimeoutMs ?: 60_000, testBody)