From 58d2cc28df5143f93145e7c8072dbab8fa2cd04b Mon Sep 17 00:00:00 2001 From: Stephen Edwards Date: Wed, 22 Jun 2022 13:39:51 -0400 Subject: [PATCH] Upgrade coroutines to 1.6.1 And update usages according to migratino guide. --- gradle/libs.versions.toml | 6 +- .../dependencies/runtimeClasspath.txt | 13 ++-- .../dependencies/releaseRuntimeClasspath.txt | 13 ++-- .../dependencies/runtimeClasspath.txt | 13 ++-- .../dependencies/jvmRuntimeClasspath.txt | 11 ++-- .../dependencies/runtimeClasspath.txt | 13 ++-- .../dependencies/jvmRuntimeClasspath.txt | 11 ++-- .../workflow1/RenderWorkflowInTest.kt | 4 ++ .../workflow1/internal/WorkflowNodeTest.kt | 65 +++++++++---------- .../dependencies/runtimeClasspath.txt | 17 ++--- .../dependencies/runtimeClasspath.txt | 19 +++--- .../java/com/squareup/workflow1/WorkerTest.kt | 12 ++-- .../testing/RenderIdempotencyCheckerTest.kt | 6 +- .../dependencies/runtimeClasspath.txt | 13 ++-- .../dependencies/releaseRuntimeClasspath.txt | 15 +++-- .../dependencies/releaseRuntimeClasspath.txt | 15 +++-- .../workflow1/ui/compose/RenderAsStateTest.kt | 47 ++++++-------- .../dependencies/releaseRuntimeClasspath.txt | 15 +++-- .../dependencies/runtimeClasspath.txt | 13 ++-- .../dependencies/releaseRuntimeClasspath.txt | 15 +++-- .../ui/ViewLaunchWhenAttachedTest.kt | 39 +++++------ .../dependencies/runtimeClasspath.txt | 13 ++-- .../dependencies/releaseRuntimeClasspath.txt | 15 +++-- 23 files changed, 205 insertions(+), 198 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e572fc5df..c5919d1da 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -49,9 +49,7 @@ kotest = "5.1.0" kotlin = "1.6.10" kotlinx-binary-compatibility = "0.6.0" -kotlinx-coroutines = "1.5.1" -# The 1.5.1 test artifact is jvm-only. The commonTest module should use 1.6.1. -kotlinx-coroutines-test-common = "1.6.1" +kotlinx-coroutines = "1.6.4" kotlinx-serialization-json = "1.3.2" kotlinx-benchmark = "0.4.2" kotlinx-atomicfu = "0.17.2" @@ -187,7 +185,7 @@ kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutine kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-rx2 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx2", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-test-common = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines-test-common" } +kotlinx-coroutines-test-common = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" } kotlinx-benchmark-gradle-plugin = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-plugin", version.ref = "kotlinx-benchmark" } kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" } diff --git a/trace-encoder/dependencies/runtimeClasspath.txt b/trace-encoder/dependencies/runtimeClasspath.txt index ec8fab80a..9fdc0b3a3 100644 --- a/trace-encoder/dependencies/runtimeClasspath.txt +++ b/trace-encoder/dependencies/runtimeClasspath.txt @@ -2,10 +2,11 @@ com.squareup.moshi:moshi-adapters:1.13.0 com.squareup.moshi:moshi:1.13.0 com.squareup.okio:okio:2.10.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-config/config-android/dependencies/releaseRuntimeClasspath.txt b/workflow-config/config-android/dependencies/releaseRuntimeClasspath.txt index 0e0e4fb6e..2bb982f26 100644 --- a/workflow-config/config-android/dependencies/releaseRuntimeClasspath.txt +++ b/workflow-config/config-android/dependencies/releaseRuntimeClasspath.txt @@ -3,10 +3,11 @@ com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-config/config-jvm/dependencies/runtimeClasspath.txt b/workflow-config/config-jvm/dependencies/runtimeClasspath.txt index 0e0e4fb6e..2bb982f26 100644 --- a/workflow-config/config-jvm/dependencies/runtimeClasspath.txt +++ b/workflow-config/config-jvm/dependencies/runtimeClasspath.txt @@ -3,10 +3,11 @@ com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-core/dependencies/jvmRuntimeClasspath.txt b/workflow-core/dependencies/jvmRuntimeClasspath.txt index 81d8321d1..67a16f8cf 100644 --- a/workflow-core/dependencies/jvmRuntimeClasspath.txt +++ b/workflow-core/dependencies/jvmRuntimeClasspath.txt @@ -1,9 +1,10 @@ com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-core/dependencies/runtimeClasspath.txt b/workflow-core/dependencies/runtimeClasspath.txt index 19adaaffc..20cd537a8 100644 --- a/workflow-core/dependencies/runtimeClasspath.txt +++ b/workflow-core/dependencies/runtimeClasspath.txt @@ -1,10 +1,11 @@ com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-runtime/dependencies/jvmRuntimeClasspath.txt b/workflow-runtime/dependencies/jvmRuntimeClasspath.txt index 645cfead0..9603fe437 100644 --- a/workflow-runtime/dependencies/jvmRuntimeClasspath.txt +++ b/workflow-runtime/dependencies/jvmRuntimeClasspath.txt @@ -2,9 +2,10 @@ com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-runtime/src/commonTest/kotlin/com/squareup/workflow1/RenderWorkflowInTest.kt b/workflow-runtime/src/commonTest/kotlin/com/squareup/workflow1/RenderWorkflowInTest.kt index e9363a51c..a4da832b0 100644 --- a/workflow-runtime/src/commonTest/kotlin/com/squareup/workflow1/RenderWorkflowInTest.kt +++ b/workflow-runtime/src/commonTest/kotlin/com/squareup/workflow1/RenderWorkflowInTest.kt @@ -215,6 +215,7 @@ class RenderWorkflowInTest { if (runtimeConfig1 is FrameTimeout) { // Get past frame timeout to ensure snapshot saved. testScope.advanceTimeBy(runtimeConfig1.frameTimeoutMs + 1) + testScope.runCurrent() } val snapshot = renderings.value.let { (rendering, snapshot) -> val (state, updateState) = rendering @@ -280,6 +281,7 @@ class RenderWorkflowInTest { if (runtimeConfig is FrameTimeout) { // Get past frame timeout to ensure snapshot saved. testScope.advanceTimeBy(runtimeConfig.frameTimeoutMs + 1) + testScope.runCurrent() } sink.send("unchanging state") @@ -287,6 +289,7 @@ class RenderWorkflowInTest { if (runtimeConfig is FrameTimeout) { // Get past frame timeout to ensure snapshot saved. testScope.advanceTimeBy(runtimeConfig.frameTimeoutMs + 1) + testScope.runCurrent() } scope.cancel() @@ -506,6 +509,7 @@ class RenderWorkflowInTest { trigger.complete(Unit) if (runtimeConfig is FrameTimeout) { testScope.advanceTimeBy(runtimeConfig.frameTimeoutMs + 1) + testScope.runCurrent() } assertFalse(testScope.isActive) } diff --git a/workflow-runtime/src/commonTest/kotlin/com/squareup/workflow1/internal/WorkflowNodeTest.kt b/workflow-runtime/src/commonTest/kotlin/com/squareup/workflow1/internal/WorkflowNodeTest.kt index c526c9035..b03d8eaf3 100644 --- a/workflow-runtime/src/commonTest/kotlin/com/squareup/workflow1/internal/WorkflowNodeTest.kt +++ b/workflow-runtime/src/commonTest/kotlin/com/squareup/workflow1/internal/WorkflowNodeTest.kt @@ -1,4 +1,5 @@ @file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION") +@file:OptIn(ExperimentalCoroutinesApi::class) package com.squareup.workflow1.internal @@ -29,12 +30,13 @@ import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers.Unconfined +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.cancel import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.runBlocking import kotlinx.coroutines.selects.select import kotlinx.coroutines.suspendCancellableCoroutine +import kotlinx.coroutines.test.runTest import kotlinx.coroutines.withTimeout import kotlin.coroutines.CoroutineContext import kotlin.test.AfterTest @@ -173,14 +175,14 @@ internal class WorkflowNodeTest { ) node.render(workflow, "")("event") - val result = runBlocking { - withTimeout(10) { + runTest { + val result = withTimeout(10) { select { node.tick(this) } as WorkflowOutput? } + assertEquals("tick:event", result?.value) } - assertEquals("tick:event", result?.value) } @Test fun `accepts events sent to stale renderings`() { @@ -210,16 +212,16 @@ internal class WorkflowNodeTest { sink("event") sink("event2") - val result = runBlocking { - withTimeout(10) { + runTest { + val result = withTimeout(10) { List(2) { select { node.tick(this) } as WorkflowOutput? } } + assertEquals(listOf("tick:event", "tick:event2"), result.map { it?.value }) } - assertEquals(listOf("tick:event", "tick:event2"), result.map { it?.value }) } @Test fun `send allows subsequent events on same rendering`() { @@ -264,7 +266,7 @@ internal class WorkflowNodeTest { snapshot = null, baseContext = context ) - runBlocking { + runTest { node.render(workflow.asStatefulWorkflow(), Unit) assertTrue(started) } @@ -302,16 +304,15 @@ internal class WorkflowNodeTest { ) node.render(workflow.asStatefulWorkflow(), Unit) - val result = runBlocking { + runTest { // Result should be available instantly, any delay at all indicates something is broken. - withTimeout(1) { + val result = withTimeout(1) { select { node.tick(this) } as WorkflowOutput? } + assertEquals("result", result?.value) } - - assertEquals("result", result?.value) } @Test fun `sideEffect is cancelled when stops being ran`() { @@ -331,7 +332,7 @@ internal class WorkflowNodeTest { snapshot = null, baseContext = context ) - runBlocking { + runTest { node.render(workflow.asStatefulWorkflow(), true) assertNull(cancellationException) @@ -357,7 +358,7 @@ internal class WorkflowNodeTest { snapshot = null, baseContext = context ) - runBlocking { + runTest { node.render(workflow.asStatefulWorkflow(), Unit) assertNull(cancellationException) @@ -383,7 +384,7 @@ internal class WorkflowNodeTest { snapshot = null, baseContext = context ) - runBlocking { + runTest { node.render(workflow.asStatefulWorkflow(), 0) assertFalse(cancelled) assertEquals(1, renderPasses) @@ -408,7 +409,7 @@ internal class WorkflowNodeTest { snapshot = null, baseContext = context ) - runBlocking { + runTest { node.render(workflow.asStatefulWorkflow(), 0) assertEquals(listOf(0), seenProps) assertEquals(1, renderPasses) @@ -1099,7 +1100,7 @@ internal class WorkflowNodeTest { sink.send("hello") - runBlocking { + runTest { select { node.tick(this) } as WorkflowOutput? @@ -1125,13 +1126,12 @@ internal class WorkflowNodeTest { rendering.send("hello") - val output = runBlocking { - select { + runTest { + val output = select { node.tick(this) } as WorkflowOutput? + assertEquals("output:hello", output?.value) } - - assertEquals("output:hello", output?.value) } @Test fun `actionSink action allows null output`() { @@ -1150,13 +1150,12 @@ internal class WorkflowNodeTest { rendering.send("hello") - val output = runBlocking { - select { + runTest { + val output = select { node.tick(this) } as WorkflowOutput? + assertNull(output?.value) } - - assertNull(output?.value) } @Test fun `child action changes state`() { @@ -1178,7 +1177,7 @@ internal class WorkflowNodeTest { ) node.render(workflow.asStatefulWorkflow(), Unit) - runBlocking { + runTest { select { node.tick(this) } as WorkflowOutput? @@ -1204,13 +1203,12 @@ internal class WorkflowNodeTest { ) node.render(workflow.asStatefulWorkflow(), Unit) - val output = runBlocking { - select { + runTest { + val output = select { node.tick(this) } as WorkflowOutput? + assertEquals("output:child:hello", output?.value) } - - assertEquals("output:child:hello", output?.value) } @Test fun `child action allows null output`() { @@ -1229,13 +1227,12 @@ internal class WorkflowNodeTest { ) node.render(workflow.asStatefulWorkflow(), Unit) - val output = runBlocking { - select { + runTest { + val output = select { node.tick(this) } as WorkflowOutput? + assertNull(output?.value) } - - assertNull(output?.value) } private class TestSession(override val sessionId: Long = 0) : WorkflowSession { diff --git a/workflow-rx2/dependencies/runtimeClasspath.txt b/workflow-rx2/dependencies/runtimeClasspath.txt index 2e945cf86..0f95ca474 100644 --- a/workflow-rx2/dependencies/runtimeClasspath.txt +++ b/workflow-rx2/dependencies/runtimeClasspath.txt @@ -3,13 +3,14 @@ com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 io.reactivex.rxjava2:rxjava:2.2.21 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-rx2:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-rx2:1.6.4 org.jetbrains:annotations:13.0 org.reactivestreams:reactive-streams:1.0.3 diff --git a/workflow-testing/dependencies/runtimeClasspath.txt b/workflow-testing/dependencies/runtimeClasspath.txt index e8d8cd8d0..e034517af 100644 --- a/workflow-testing/dependencies/runtimeClasspath.txt +++ b/workflow-testing/dependencies/runtimeClasspath.txt @@ -4,16 +4,15 @@ :workflow-runtime com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 -net.java.dev.jna:jna-platform:5.5.0 -net.java.dev.jna:jna:5.5.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 org.jetbrains.kotlin:kotlin-reflect:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-test-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-testing/src/test/java/com/squareup/workflow1/WorkerTest.kt b/workflow-testing/src/test/java/com/squareup/workflow1/WorkerTest.kt index 4f9e847c2..69fd5b83f 100644 --- a/workflow-testing/src/test/java/com/squareup/workflow1/WorkerTest.kt +++ b/workflow-testing/src/test/java/com/squareup/workflow1/WorkerTest.kt @@ -3,14 +3,16 @@ package com.squareup.workflow1 import com.squareup.workflow1.testing.test +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOn -import kotlinx.coroutines.test.TestCoroutineDispatcher +import kotlinx.coroutines.test.StandardTestDispatcher import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotSame import kotlin.test.assertTrue /** Worker tests that use the [Worker.test] function. Core tests are in the core module. */ +@OptIn(ExperimentalCoroutinesApi::class) internal class WorkerTest { private class ExpectedException : RuntimeException() @@ -119,7 +121,7 @@ internal class WorkerTest { } @Test fun `timer emits and finishes after delay`() { - val testDispatcher = TestCoroutineDispatcher() + val testDispatcher = StandardTestDispatcher() val worker = Worker.timer(1000) // Run the timer on the test dispatcher so we can control time. .transform { it.flowOn(testDispatcher) } @@ -128,11 +130,13 @@ internal class WorkerTest { assertNoOutput() assertNotFinished() - testDispatcher.advanceTimeBy(999) + testDispatcher.scheduler.advanceTimeBy(999) + testDispatcher.scheduler.runCurrent() assertNoOutput() assertNotFinished() - testDispatcher.advanceTimeBy(1) + testDispatcher.scheduler.advanceTimeBy(1) + testDispatcher.scheduler.runCurrent() assertEquals(Unit, nextOutput()) assertFinished() } diff --git a/workflow-testing/src/test/java/com/squareup/workflow1/testing/RenderIdempotencyCheckerTest.kt b/workflow-testing/src/test/java/com/squareup/workflow1/testing/RenderIdempotencyCheckerTest.kt index c99227937..c00021d6b 100644 --- a/workflow-testing/src/test/java/com/squareup/workflow1/testing/RenderIdempotencyCheckerTest.kt +++ b/workflow-testing/src/test/java/com/squareup/workflow1/testing/RenderIdempotencyCheckerTest.kt @@ -8,9 +8,8 @@ import com.squareup.workflow1.stateless import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers.Unconfined import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.test.TestCoroutineScope +import kotlinx.coroutines.test.TestScope import kotlin.test.Test import kotlin.test.assertEquals @@ -26,8 +25,7 @@ class RenderIdempotencyCheckerTest { rootRenders++ renderChild(leafWorkflow) } - val scope = TestCoroutineScope(Job()) - .apply { pauseDispatcher() } + val scope = TestScope() renderWorkflowIn( rootWorkflow, scope, MutableStateFlow(Unit), interceptors = listOf(RenderIdempotencyChecker) diff --git a/workflow-tracing/dependencies/runtimeClasspath.txt b/workflow-tracing/dependencies/runtimeClasspath.txt index c694d8f99..5df0412d1 100644 --- a/workflow-tracing/dependencies/runtimeClasspath.txt +++ b/workflow-tracing/dependencies/runtimeClasspath.txt @@ -6,10 +6,11 @@ com.squareup.moshi:moshi:1.13.0 com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-ui/compose-tooling/dependencies/releaseRuntimeClasspath.txt b/workflow-ui/compose-tooling/dependencies/releaseRuntimeClasspath.txt index 846b8f021..e4b5bfbb6 100644 --- a/workflow-ui/compose-tooling/dependencies/releaseRuntimeClasspath.txt +++ b/workflow-ui/compose-tooling/dependencies/releaseRuntimeClasspath.txt @@ -64,11 +64,12 @@ androidx.viewpager:viewpager:1.0.0 com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.2 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-ui/compose/dependencies/releaseRuntimeClasspath.txt b/workflow-ui/compose/dependencies/releaseRuntimeClasspath.txt index 3ec147f70..10f5ab0a1 100644 --- a/workflow-ui/compose/dependencies/releaseRuntimeClasspath.txt +++ b/workflow-ui/compose/dependencies/releaseRuntimeClasspath.txt @@ -54,11 +54,12 @@ androidx.viewpager:viewpager:1.0.0 com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.2 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/RenderAsStateTest.kt b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/RenderAsStateTest.kt index cdff73fd7..b54d9d180 100644 --- a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/RenderAsStateTest.kt +++ b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/RenderAsStateTest.kt @@ -33,7 +33,10 @@ import kotlinx.coroutines.Job import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.isActive import kotlinx.coroutines.job -import kotlinx.coroutines.test.TestCoroutineScope +import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.UnconfinedTestDispatcher +import kotlinx.coroutines.test.advanceUntilIdle +import kotlinx.coroutines.test.runTest import okio.ByteString import okio.ByteString.Companion.decodeBase64 import org.junit.Rule @@ -113,7 +116,7 @@ internal class RenderAsStateTest { val workflow = SnapshottingWorkflow() val savedStateRegistry = SaveableStateRegistry(emptyMap()) { true } lateinit var rendering: SnapshottedRendering - val scope = TestCoroutineScope() + val scope = TestScope() composeRule.setContent { CompositionLocalProvider(LocalSaveableStateRegistry provides savedStateRegistry) { @@ -177,7 +180,7 @@ internal class RenderAsStateTest { val stateRestorationTester = StateRestorationTester(composeRule) val workflow = SnapshottingWorkflow() lateinit var rendering: SnapshottedRendering - val scope = TestCoroutineScope() + val scope = TestScope() stateRestorationTester.setContent { rendering = workflow.renderAsState( @@ -210,7 +213,7 @@ internal class RenderAsStateTest { lateinit var rendering: SnapshottedRendering // Since we have frame timeouts we need to control the scope of the Workflow Runtime as // well as the scope of the Recomposer. - val scope = TestCoroutineScope() + val scope = TestScope() var compositionCount = 0 var lastCompositionCount = 0 @@ -254,21 +257,15 @@ internal class RenderAsStateTest { @Test fun renderingIsAvailableImmediatelyWhenWorkflowScopeUsesDifferentDispatcher() { val workflow = Workflow.rendering("hello") - val scope = TestCoroutineScope() + val scope = TestScope() - // Ensure the workflow runtime won't actually run aside from the synchronous first pass. - scope.pauseDispatcher() - - try { - composeRule.setContent { - val initialRendering = workflow.renderAsState( - props = Unit, onOutput = {}, - scope = scope - ) - assertThat(initialRendering.value).isNotNull() - } - } finally { - scope.cleanupTestCoroutines() + composeRule.setContent { + val initialRendering = workflow.renderAsState( + props = Unit, + onOutput = {}, + scope = scope + ) + assertThat(initialRendering.value).isNotNull() } } @@ -280,11 +277,11 @@ internal class RenderAsStateTest { awaitCancellation() } } - val scope = TestCoroutineScope() + val scope = TestScope(UnconfinedTestDispatcher()) class CancelCompositionException : RuntimeException() - try { + scope.runTest { assertFailsWith { composeRule.setContent { workflow.renderAsState(props = Unit, onOutput = {}, scope = scope) @@ -293,22 +290,18 @@ internal class RenderAsStateTest { } composeRule.runOnIdle { - scope.advanceUntilIdle() - assertThat(innerJob).isNotNull() assertThat(innerJob!!.isCancelled).isTrue() } - } finally { - scope.cleanupTestCoroutines() } } @Test fun workflowScopeIsNotCancelledWhenRemovedFromComposition() { val workflow = Workflow.stateless {} - val scope = TestCoroutineScope(Job()) + val scope = TestScope() var shouldRunWorkflow by mutableStateOf(true) - try { + scope.runTest { composeRule.setContent { if (shouldRunWorkflow) { workflow.renderAsState(props = Unit, onOutput = {}, scope = scope) @@ -325,8 +318,6 @@ internal class RenderAsStateTest { scope.advanceUntilIdle() assertThat(scope.isActive).isTrue() } - } finally { - scope.cleanupTestCoroutines() } } diff --git a/workflow-ui/container-android/dependencies/releaseRuntimeClasspath.txt b/workflow-ui/container-android/dependencies/releaseRuntimeClasspath.txt index 1f15c4407..784bccf30 100644 --- a/workflow-ui/container-android/dependencies/releaseRuntimeClasspath.txt +++ b/workflow-ui/container-android/dependencies/releaseRuntimeClasspath.txt @@ -37,11 +37,12 @@ androidx.viewpager:viewpager:1.0.0 com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-ui/container-common/dependencies/runtimeClasspath.txt b/workflow-ui/container-common/dependencies/runtimeClasspath.txt index 5a9d00718..a13fa5b5f 100644 --- a/workflow-ui/container-common/dependencies/runtimeClasspath.txt +++ b/workflow-ui/container-common/dependencies/runtimeClasspath.txt @@ -2,10 +2,11 @@ com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-ui/core-android/dependencies/releaseRuntimeClasspath.txt b/workflow-ui/core-android/dependencies/releaseRuntimeClasspath.txt index ee28cf72b..aae04f5f6 100644 --- a/workflow-ui/core-android/dependencies/releaseRuntimeClasspath.txt +++ b/workflow-ui/core-android/dependencies/releaseRuntimeClasspath.txt @@ -28,11 +28,12 @@ androidx.viewpager:viewpager:1.0.0 com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-ui/core-android/src/test/java/com/squareup/workflow1/ui/ViewLaunchWhenAttachedTest.kt b/workflow-ui/core-android/src/test/java/com/squareup/workflow1/ui/ViewLaunchWhenAttachedTest.kt index 5e7e3500c..3aace24c7 100644 --- a/workflow-ui/core-android/src/test/java/com/squareup/workflow1/ui/ViewLaunchWhenAttachedTest.kt +++ b/workflow-ui/core-android/src/test/java/com/squareup/workflow1/ui/ViewLaunchWhenAttachedTest.kt @@ -13,8 +13,10 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.job import kotlinx.coroutines.suspendCancellableCoroutine -import kotlinx.coroutines.test.TestCoroutineDispatcher +import kotlinx.coroutines.test.StandardTestDispatcher +import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.resetMain +import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.setMain import org.junit.After import org.junit.Before @@ -34,26 +36,22 @@ import org.mockito.kotlin.whenever @OptIn(ExperimentalCoroutinesApi::class, WorkflowUiExperimentalApi::class) internal class ViewLaunchWhenAttachedTest { - private val dispatcher = TestCoroutineDispatcher() private val view = mockView() private val onAttachStateChangeListener = argumentCaptor() @Before fun setUp() { - Dispatchers.setMain(dispatcher) + Dispatchers.setMain(StandardTestDispatcher()) } @After fun tearDown() { - dispatcher.cleanupTestCoroutines() Dispatchers.resetMain() } - @Test fun `launchWhenAttached launches synchronously when already attached`() { + @Test fun `launchWhenAttached launches synchronously when already attached`() = runTest { var innerJob: Job? = null var started = false mockAttachedToWindow(view, true) - // Pause the dispatcher to verify that the coroutine is started synchronously. - dispatcher.pauseDispatcher() // Action: launch a coroutine! view.launchWhenAttached { @@ -74,9 +72,8 @@ internal class ViewLaunchWhenAttachedTest { assertThat(innerJob!!.isCancelled).isTrue() } - @Test fun `launchWhenAttached cancels when detached while launching`() { + @Test fun `launchWhenAttached cancels when detached while launching`() = runTest { mockAttachedToWindow(view, true) - dispatcher.pauseDispatcher() // Action: launch a coroutine! view.launchWhenAttached { @@ -88,7 +85,7 @@ internal class ViewLaunchWhenAttachedTest { } } - @Test fun `launchWhenAttached launches when attached later`() { + @Test fun `launchWhenAttached launches when attached later`() = runTest { var innerJob: Job? = null mockAttachedToWindow(view, false) @@ -99,14 +96,14 @@ internal class ViewLaunchWhenAttachedTest { } } - dispatcher.advanceUntilIdle() + testScheduler.advanceUntilIdle() assertThat(innerJob).isNull() verify(view).setTag(isA(), isA()) // Action: attach view! performViewAttach() - dispatcher.advanceUntilIdle() + testScheduler.advanceUntilIdle() assertThat(innerJob).isNotNull() assertThat(innerJob!!.isActive).isTrue() @@ -115,7 +112,7 @@ internal class ViewLaunchWhenAttachedTest { assertThat(innerJob!!.isCancelled).isTrue() } - @Test fun `launchWhenAttached launches when reattached`() { + @Test fun `launchWhenAttached launches when reattached`() = runTest { var innerJob: Job? = null mockAttachedToWindow(view, true) @@ -131,7 +128,7 @@ internal class ViewLaunchWhenAttachedTest { } // The coroutine shouldn't have started since the view is detached. - dispatcher.advanceUntilIdle() + testScheduler.advanceUntilIdle() assertThat(innerJob).isNull() // Action: re-attach view! @@ -144,7 +141,7 @@ internal class ViewLaunchWhenAttachedTest { assertThat(innerJob!!.isActive).isTrue() } - @Test fun `launchWhenAttached coroutine is child of ViewTreeLifecycleOwner`() { + @Test fun `launchWhenAttached coroutine is child of ViewTreeLifecycleOwner`() = runTest { var innerJob: Job? = null mockAttachedToWindow(view, true) @@ -154,6 +151,7 @@ internal class ViewLaunchWhenAttachedTest { innerJob = continuation.context.job } } + testScheduler.advanceUntilIdle() assertThat(innerJob!!.isActive).isTrue() @@ -164,7 +162,7 @@ internal class ViewLaunchWhenAttachedTest { assertThat(innerJob!!.isCancelled).isTrue() } - @Test fun `launchWhenAttached includes view classname in coroutine name`() { + @Test fun `launchWhenAttached includes view classname in coroutine name`() = runTest { var coroutineName: String? = null mockAttachedToWindow(view, true) @@ -178,7 +176,7 @@ internal class ViewLaunchWhenAttachedTest { assertThat(coroutineName).contains("${view.hashCode()}") } - @Test fun `launchWhenAttached includes view id name in coroutine name`() { + @Test fun `launchWhenAttached includes view id name in coroutine name`() = runTest { var coroutineName: String? = null mockAttachedToWindow(view, true) whenever(view.resources.getResourceEntryName(anyInt())).thenReturn("fnord") @@ -191,7 +189,7 @@ internal class ViewLaunchWhenAttachedTest { assertThat(coroutineName).contains("fnord") } - @Test fun `launchWhenAttached tolerates garbage ids`() { + @Test fun `launchWhenAttached tolerates garbage ids`() = runTest { var coroutineName: String? = null mockAttachedToWindow(view, true) whenever(view.resources.getResourceEntryName(anyInt())).thenThrow(NotFoundException()) @@ -224,7 +222,10 @@ internal class ViewLaunchWhenAttachedTest { return mock(defaultAnswer = RETURNS_DEEP_STUBS).also { mockTags(it) mockAttachedToWindow(it) - ViewTreeLifecycleOwner.set(it, TestLifecycleOwner(coroutineDispatcher = dispatcher)) + ViewTreeLifecycleOwner.set( + it, + TestLifecycleOwner(coroutineDispatcher = UnconfinedTestDispatcher()) + ) } } diff --git a/workflow-ui/core-common/dependencies/runtimeClasspath.txt b/workflow-ui/core-common/dependencies/runtimeClasspath.txt index 19adaaffc..20cd537a8 100644 --- a/workflow-ui/core-common/dependencies/runtimeClasspath.txt +++ b/workflow-ui/core-common/dependencies/runtimeClasspath.txt @@ -1,10 +1,11 @@ com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0 diff --git a/workflow-ui/radiography/dependencies/releaseRuntimeClasspath.txt b/workflow-ui/radiography/dependencies/releaseRuntimeClasspath.txt index a5efc6858..7fb5246c0 100644 --- a/workflow-ui/radiography/dependencies/releaseRuntimeClasspath.txt +++ b/workflow-ui/radiography/dependencies/releaseRuntimeClasspath.txt @@ -31,11 +31,12 @@ com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 com.squareup.radiography:radiography:2.4.0 org.jetbrains.kotlin:kotlin-bom:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.1 -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1 +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 +org.jetbrains.kotlin:kotlin-stdlib:1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 org.jetbrains:annotations:13.0