From c280f7fe82045a87ac091d61f1e578d48df5f036 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 12 Jun 2022 02:24:10 +0000 Subject: [PATCH 1/5] chore(deps): update plugin com.diffplug.spotless to v6.7.2 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 44cacd6f..214b2daa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ import java.net.URL plugins { kotlin("multiplatform") version "1.6.21" - id("com.diffplug.spotless") version "6.6.1" + id("com.diffplug.spotless") version "6.7.2" id("maven-publish") id("com.vanniktech.maven.publish") version "0.20.0" id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.10.0" From e6f1b7de5ff00aa9ed5e96590f2586e082e8b360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petrus=20Nguy=E1=BB=85n=20Th=C3=A1i=20H=E1=BB=8Dc?= Date: Wed, 15 Jun 2022 11:25:18 +0700 Subject: [PATCH 2/5] Update build.gradle.kts --- build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 214b2daa..dec299c1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -154,7 +154,7 @@ spotless { kotlin { target("**/*.kt") - ktlint(ktlintVersion).userData( + ktlint(ktlintVersion).editorConfigOverride( mapOf( // TODO this should all come from editorconfig https://github.com/diffplug/spotless/issues/142 "indent_size" to "2", @@ -175,7 +175,7 @@ spotless { kotlinGradle { target("**/*.kts") - ktlint(ktlintVersion).userData( + ktlint(ktlintVersion).editorConfigOverride( mapOf( "indent_size" to "2", "ij_kotlin_imports_layout" to "*", From a38eef08c69df0196e8f684030345b7c2a01172b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petrus=20Nguy=E1=BB=85n=20Th=C3=A1i=20H=E1=BB=8Dc?= Date: Wed, 15 Jun 2022 12:03:08 +0700 Subject: [PATCH 3/5] Update build.gradle.kts ktlintVersion = "0.45.2" --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index dec299c1..3f03037e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,7 +19,7 @@ plugins { } val coroutinesVersion = "1.6.1" -val ktlintVersion = "0.44.0" +val ktlintVersion = "0.45.2" repositories { mavenCentral() From fe1a73d2ea5ac332ac751d5ef3d283c6dd9a2410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petrus=20Nguy=E1=BB=85n=20Th=C3=A1i=20H=E1=BB=8Dc?= Date: Tue, 28 Jun 2022 16:21:50 +0700 Subject: [PATCH 4/5] style: spotlessApply --- .editorconfig | 16 +++-- build.gradle.kts | 51 ++++++++++------ .../kotlin/com/hoc081098/flowext/concat.kt | 10 ++-- .../kotlin/com/hoc081098/flowext/eager.kt | 6 +- .../kotlin/com/hoc081098/flowext/interval.kt | 6 +- .../flowext/retryWhenWithDelayStrategy.kt | 10 ++-- .../kotlin/com/hoc081098/flowext/throttle.kt | 10 ++-- .../kotlin/com/hoc081098/flowext/timer.kt | 2 +- .../com/hoc081098/flowext/withLatestFrom.kt | 2 +- .../com/hoc081098/flowext/BufferCountTest.kt | 18 +++--- .../com/hoc081098/flowext/ConcatTest.kt | 60 +++++++++---------- .../kotlin/com/hoc081098/flowext/DeferTest.kt | 2 +- .../hoc081098/flowext/DematerializeTest.kt | 26 ++++---- .../kotlin/com/hoc081098/flowext/EventTest.kt | 22 +++---- .../flowext/FlatMapConcatEagerTest.kt | 8 +-- .../com/hoc081098/flowext/FlatMapFirstTest.kt | 21 ++++--- .../hoc081098/flowext/FlowFromSuspendTest.kt | 2 +- .../com/hoc081098/flowext/IntervalTest.kt | 2 +- .../com/hoc081098/flowext/MapIndexedTest.kt | 12 ++-- .../kotlin/com/hoc081098/flowext/MapToTest.kt | 4 +- .../com/hoc081098/flowext/MaterializeTest.kt | 34 +++++------ .../kotlin/com/hoc081098/flowext/RaceTest.kt | 16 ++--- .../kotlin/com/hoc081098/flowext/RangeTest.kt | 4 +- .../flowext/RetryWhenWithDelayStrategyTest.kt | 32 +++++----- .../com/hoc081098/flowext/StartWithTest.kt | 6 +- .../com/hoc081098/flowext/TakeUntilTest.kt | 14 ++--- .../com/hoc081098/flowext/ThrottleTest.kt | 30 +++++----- .../kotlin/com/hoc081098/flowext/TimerTest.kt | 10 ++-- .../hoc081098/flowext/WithLatestFromTest.kt | 12 ++-- .../com/hoc081098/flowext/utils/BaseTest.kt | 8 +-- .../flowext/utils/NamedDispatchers.kt | 4 +- .../com/hoc081098/flowext/utils/testFlow.kt | 4 +- .../com/hoc081098/flowext/TakeUntilJvmTest.kt | 16 ++--- .../com/hoc081098/flowext/ThrottleJvmTest.kt | 34 +++++------ .../flowext/WithLatestFromJvmTest.kt | 14 ++--- 35 files changed, 273 insertions(+), 255 deletions(-) diff --git a/.editorconfig b/.editorconfig index 7a7288fc..9e49c1ad 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,12 +1,10 @@ root = true - [*] -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = false - +indent_size=2 +end_of_line=lf +charset=utf-8 +trim_trailing_whitespace=true +insert_final_newline=true [*.{kt, kts}] -ij_kotlin_imports_layout = * -disabled_rules=filename \ No newline at end of file +ij_kotlin_imports_layout=* +disabled_rules=filename diff --git a/build.gradle.kts b/build.gradle.kts index 3f03037e..11f85eff 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,12 @@ import com.vanniktech.maven.publish.MavenPublishBaseExtension import com.vanniktech.maven.publish.MavenPublishBasePlugin import com.vanniktech.maven.publish.SonatypeHost +import java.net.URL import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithTests import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType -import java.net.URL plugins { kotlin("multiplatform") version "1.6.21" @@ -120,7 +120,7 @@ kotlin { "watchosArm32", "watchosArm64", "watchosX86", - "watchosX64", + "watchosX64" ) (appleTargets + listOf("mingwX64", "linuxX64")).forEach { @@ -151,20 +151,32 @@ kotlin { } spotless { + val EDITOR_CONFIG_KEYS: Set = hashSetOf( + "ij_kotlin_imports_layout", + "indent_size", + "end_of_line", + "charset", + "continuation_indent_size" + ) + kotlin { target("**/*.kt") - ktlint(ktlintVersion).editorConfigOverride( - mapOf( - // TODO this should all come from editorconfig https://github.com/diffplug/spotless/issues/142 - "indent_size" to "2", - "ij_kotlin_imports_layout" to "*", - "end_of_line" to "lf", - "charset" to "utf-8", - "disabled_rules" to "filename" - ) + // TODO this should all come from editorconfig https://github.com/diffplug/spotless/issues/142 + val data = mapOf( + "indent_size" to "2", + "continuation_indent_size" to "4", + "ij_kotlin_imports_layout" to "*", + "end_of_line" to "lf", + "charset" to "utf-8", + "disabled_rules" to arrayOf("filename").joinToString(separator = ",") ) + ktlint(ktlintVersion) + .setUseExperimental(true) + .userData(data.filterKeys { it !in EDITOR_CONFIG_KEYS }) + .editorConfigOverride(data.filterKeys { it in EDITOR_CONFIG_KEYS }) + trimTrailingWhitespace() indentWithSpaces() endWithNewline() @@ -175,14 +187,17 @@ spotless { kotlinGradle { target("**/*.kts") - ktlint(ktlintVersion).editorConfigOverride( - mapOf( - "indent_size" to "2", - "ij_kotlin_imports_layout" to "*", - "end_of_line" to "lf", - "charset" to "utf-8" - ) + val data = mapOf( + "indent_size" to "2", + "continuation_indent_size" to "4", + "ij_kotlin_imports_layout" to "*", + "end_of_line" to "lf", + "charset" to "utf-8" ) + ktlint(ktlintVersion) + .setUseExperimental(true) + .userData(data.filterKeys { it !in EDITOR_CONFIG_KEYS }) + .editorConfigOverride(data.filterKeys { it in EDITOR_CONFIG_KEYS }) trimTrailingWhitespace() indentWithSpaces() diff --git a/src/commonMain/kotlin/com/hoc081098/flowext/concat.kt b/src/commonMain/kotlin/com/hoc081098/flowext/concat.kt index 362cebe6..f87e03c9 100644 --- a/src/commonMain/kotlin/com/hoc081098/flowext/concat.kt +++ b/src/commonMain/kotlin/com/hoc081098/flowext/concat.kt @@ -195,7 +195,7 @@ public fun Flow.startWith(item1: T, item2: T): Flow = concat( emit(item1) emit(item2) }, - this, + this ) /** @@ -207,7 +207,7 @@ public fun Flow.startWith(item1: T, item2: T, item3: T): Flow = concat emit(item2) emit(item3) }, - this, + this ) /** @@ -220,7 +220,7 @@ public fun Flow.startWith(item1: T, item2: T, item3: T, item4: T): Flow Flow.startWith(item1: T, item2: T, item3: T, item4: T, item5: emit(item4) emit(item5) }, - this, + this ) /** @@ -249,7 +249,7 @@ public fun Flow.startWith(item: T, vararg items: T): Flow { emit(it) } }, - this, + this ) } diff --git a/src/commonMain/kotlin/com/hoc081098/flowext/eager.kt b/src/commonMain/kotlin/com/hoc081098/flowext/eager.kt index eb166109..9cd7c203 100644 --- a/src/commonMain/kotlin/com/hoc081098/flowext/eager.kt +++ b/src/commonMain/kotlin/com/hoc081098/flowext/eager.kt @@ -50,7 +50,7 @@ import kotlinx.coroutines.launch @FlowPreview public fun Flow.mapEager( concurrency: Int = DEFAULT_CONCURRENCY, - transform: suspend (value: T) -> R, + transform: suspend (value: T) -> R ): Flow = if (concurrency == 1) { map(transform) } else { @@ -81,7 +81,7 @@ public fun Flow.mapEager( public fun Flow.flatMapConcatEager( concurrency: Int = DEFAULT_CONCURRENCY, bufferSize: Int = Channel.BUFFERED, - transform: suspend (value: T) -> Flow, + transform: suspend (value: T) -> Flow ): Flow = map(transform).flattenConcatEager(concurrency, bufferSize) /** @@ -109,7 +109,7 @@ public fun Flow.flatMapConcatEager( @FlowPreview public fun Flow>.flattenConcatEager( concurrency: Int = DEFAULT_CONCURRENCY, - bufferSize: Int = Channel.BUFFERED, + bufferSize: Int = Channel.BUFFERED ): Flow { require(concurrency > 0) { "Expected positive concurrency level, but had $concurrency" } return if (concurrency == 1) flattenConcat() else flattenConcatEagerInternal(this, concurrency, bufferSize) diff --git a/src/commonMain/kotlin/com/hoc081098/flowext/interval.kt b/src/commonMain/kotlin/com/hoc081098/flowext/interval.kt index 1bbe60bb..30b1911e 100644 --- a/src/commonMain/kotlin/com/hoc081098/flowext/interval.kt +++ b/src/commonMain/kotlin/com/hoc081098/flowext/interval.kt @@ -24,10 +24,10 @@ package com.hoc081098.flowext +import kotlin.time.Duration import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow -import kotlin.time.Duration /** * Returns a [Flow] that emits a 0L after the [initialDelay] and ever-increasing numbers @@ -38,7 +38,7 @@ import kotlin.time.Duration */ public fun interval( initialDelay: Duration, - period: Duration, + period: Duration ): Flow { require(initialDelay >= Duration.ZERO) { "Expected non-negative delay, but has $initialDelay ms" } require(period >= Duration.ZERO) { "Expected non-negative period, but has $period ms" } @@ -63,7 +63,7 @@ public fun interval( */ public fun interval( initialDelayMillis: Long, - periodMillis: Long, + periodMillis: Long ): Flow { require(initialDelayMillis >= 0) { "Expected non-negative delay, but has $initialDelayMillis ms" } require(periodMillis >= 0) { "Expected non-negative periodMillis, but has $periodMillis ms" } diff --git a/src/commonMain/kotlin/com/hoc081098/flowext/retryWhenWithDelayStrategy.kt b/src/commonMain/kotlin/com/hoc081098/flowext/retryWhenWithDelayStrategy.kt index cd17592e..1127b720 100644 --- a/src/commonMain/kotlin/com/hoc081098/flowext/retryWhenWithDelayStrategy.kt +++ b/src/commonMain/kotlin/com/hoc081098/flowext/retryWhenWithDelayStrategy.kt @@ -24,12 +24,12 @@ package com.hoc081098.flowext +import kotlin.math.pow +import kotlin.time.Duration import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector import kotlinx.coroutines.flow.retryWhen -import kotlin.math.pow -import kotlin.time.Duration /** * Interface that computes the delay between retries. @@ -87,7 +87,7 @@ public fun interface DelayStrategy { public class ExponentialBackoffDelayStrategy( private val initialDelay: Duration, private val factor: Double, - private val maxDelay: Duration, + private val maxDelay: Duration ) : DelayStrategy { override fun nextDelay(cause: Throwable, attempt: Long): Duration = (if (attempt <= 0L) initialDelay else initialDelay * factor.pow(attempt.toDouble())) @@ -133,9 +133,9 @@ public fun Flow.retryWhenWithExponentialBackoff( strategy = DelayStrategy.ExponentialBackoffDelayStrategy( initialDelay = initialDelay, factor = factor, - maxDelay = maxDelay, + maxDelay = maxDelay ), - predicate = predicate, + predicate = predicate ) /** diff --git a/src/commonMain/kotlin/com/hoc081098/flowext/throttle.kt b/src/commonMain/kotlin/com/hoc081098/flowext/throttle.kt index d05b6e51..ad85b548 100644 --- a/src/commonMain/kotlin/com/hoc081098/flowext/throttle.kt +++ b/src/commonMain/kotlin/com/hoc081098/flowext/throttle.kt @@ -29,6 +29,8 @@ import com.hoc081098.flowext.ThrottleConfiguration.LEADING_AND_TRAILING import com.hoc081098.flowext.ThrottleConfiguration.TRAILING import com.hoc081098.flowext.internal.DONE_VALUE import com.hoc081098.flowext.utils.NULL_VALUE +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.cancelAndJoin @@ -41,8 +43,6 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow import kotlinx.coroutines.launch import kotlinx.coroutines.selects.select -import kotlin.time.Duration -import kotlin.time.Duration.Companion.milliseconds /** * Define leading and trailing behavior. @@ -123,7 +123,7 @@ private inline val ThrottleConfiguration.isTrailing: Boolean @ExperimentalCoroutinesApi public fun Flow.throttleTime( duration: Duration, - throttleConfiguration: ThrottleConfiguration = LEADING, + throttleConfiguration: ThrottleConfiguration = LEADING ): Flow = throttleTime(throttleConfiguration) { duration } /** @@ -178,7 +178,7 @@ public fun Flow.throttleTime( @ExperimentalCoroutinesApi public fun Flow.throttleTime( timeMillis: Long, - throttleConfiguration: ThrottleConfiguration = LEADING, + throttleConfiguration: ThrottleConfiguration = LEADING ): Flow = throttleTime(throttleConfiguration) { timeMillis.milliseconds } /** @@ -233,7 +233,7 @@ public fun Flow.throttleTime( @ExperimentalCoroutinesApi public fun Flow.throttleTime( throttleConfiguration: ThrottleConfiguration = LEADING, - durationSelector: (value: T) -> Duration, + durationSelector: (value: T) -> Duration ): Flow = flow { val leading = throttleConfiguration.isLeading val trailing = throttleConfiguration.isTrailing diff --git a/src/commonMain/kotlin/com/hoc081098/flowext/timer.kt b/src/commonMain/kotlin/com/hoc081098/flowext/timer.kt index 6bd8b15c..f0ded4b0 100644 --- a/src/commonMain/kotlin/com/hoc081098/flowext/timer.kt +++ b/src/commonMain/kotlin/com/hoc081098/flowext/timer.kt @@ -24,10 +24,10 @@ package com.hoc081098.flowext +import kotlin.time.Duration import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow -import kotlin.time.Duration /** * Creates a [Flow] that will wait for a specified time, before emitting the [value]. diff --git a/src/commonMain/kotlin/com/hoc081098/flowext/withLatestFrom.kt b/src/commonMain/kotlin/com/hoc081098/flowext/withLatestFrom.kt index aa81d792..f1792a29 100644 --- a/src/commonMain/kotlin/com/hoc081098/flowext/withLatestFrom.kt +++ b/src/commonMain/kotlin/com/hoc081098/flowext/withLatestFrom.kt @@ -57,7 +57,7 @@ public fun Flow.withLatestFrom( transform( value, NULL_VALUE.unbox(otherRef.value ?: return@collect) - ), + ) ) } } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/BufferCountTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/BufferCountTest.kt index 27f1dfed..ab5a6d5c 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/BufferCountTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/BufferCountTest.kt @@ -27,6 +27,9 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertContentEquals +import kotlin.test.assertIs import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow @@ -36,9 +39,6 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.take import kotlinx.coroutines.launch import kotlinx.coroutines.test.advanceUntilIdle -import kotlin.test.Test -import kotlin.test.assertContentEquals -import kotlin.test.assertIs @ExperimentalCoroutinesApi @InternalCoroutinesApi @@ -53,7 +53,7 @@ class BufferCountTest : BaseTest() { Event.Value(listOf(3, 4, 5)), Event.Value(listOf(6, 7, 8)), Event.Value(listOf(9)), - Event.Complete, + Event.Complete ) ) } @@ -72,7 +72,7 @@ class BufferCountTest : BaseTest() { Event.Value(listOf(5, 6, 7)), Event.Value(listOf(6, 7)), Event.Value(listOf(7)), - Event.Complete, + Event.Complete ) ) @@ -83,7 +83,7 @@ class BufferCountTest : BaseTest() { Event.Value(listOf(0, 1)), Event.Value(listOf(4, 5)), Event.Value(listOf(8, 9)), - Event.Complete, + Event.Complete ) ) } @@ -112,7 +112,7 @@ class BufferCountTest : BaseTest() { listOf( Event.Value(listOf(0, 1, 2, 3)), Event.Value(listOf(4, 5, 6, 7)), - Event.Complete, + Event.Complete ) ) } @@ -126,7 +126,7 @@ class BufferCountTest : BaseTest() { listOf( Event.Value(listOf(0, 1, 2, 3)), Event.Value(listOf(2, 3, 4, 5)), - Event.Complete, + Event.Complete ) ) } @@ -157,7 +157,7 @@ class BufferCountTest : BaseTest() { results, listOf( listOf(1, 2, 3), - listOf(2, 3, 4), + listOf(2, 3, 4) ) ) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/ConcatTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/ConcatTest.kt index da675232..0d29d205 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/ConcatTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/ConcatTest.kt @@ -27,13 +27,13 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertIs @ExperimentalCoroutinesApi @InternalCoroutinesApi @@ -42,20 +42,20 @@ class ConcatTest : BaseTest() { fun testConcat_shouldEmitValuesFromMultipleFlows() = runTest { concat( flow1 = flowOf(1, 2, 3), - flow2 = flowOf(4, 5, 6), + flow2 = flowOf(4, 5, 6) ).test((1..6).map { Event.Value(it) } + Event.Complete) concat( flow1 = flowOf(1, 2, 3), flow2 = flowOf(4, 5, 6), - flow3 = flowOf(7, 8, 9), + flow3 = flowOf(7, 8, 9) ).test((1..9).map { Event.Value(it) } + Event.Complete) concat( flow1 = flowOf(1, 2, 3), flow2 = flowOf(4, 5, 6), flow3 = flowOf(7, 8, 9), - flow4 = flowOf(10, 11, 12), + flow4 = flowOf(10, 11, 12) ).test((1..12).map { Event.Value(it) } + Event.Complete) concat( @@ -63,7 +63,7 @@ class ConcatTest : BaseTest() { flow2 = flowOf(4, 5, 6), flow3 = flowOf(7, 8, 9), flow4 = flowOf(10, 11, 12), - flow5 = flowOf(13, 14, 15), + flow5 = flowOf(13, 14, 15) ).test((1..15).map { Event.Value(it) } + Event.Complete) concat( @@ -72,7 +72,7 @@ class ConcatTest : BaseTest() { flowOf(7, 8, 9), flowOf(10, 11, 12), flowOf(13, 14, 15), - flowOf(16, 17, 18), + flowOf(16, 17, 18) ).test((1..18).map { Event.Value(it) } + Event.Complete) concat( @@ -82,7 +82,7 @@ class ConcatTest : BaseTest() { flowOf(7, 8, 9), flowOf(10, 11, 12), flowOf(13, 14, 15), - flowOf(16, 17, 18), + flowOf(16, 17, 18) ) ).test((1..18).map { Event.Value(it) } + Event.Complete) @@ -93,7 +93,7 @@ class ConcatTest : BaseTest() { flowOf(7, 8, 9), flowOf(10, 11, 12), flowOf(13, 14, 15), - flowOf(16, 17, 18), + flowOf(16, 17, 18) ) ).test((1..18).map { Event.Value(it) } + Event.Complete) @@ -104,7 +104,7 @@ class ConcatTest : BaseTest() { flowOf(1, 2, 3) .concatWith( flowOf(4, 5, 6), - flowOf(7, 8, 9), + flowOf(7, 8, 9) ) .test((1..9).map { Event.Value(it) } + Event.Complete) @@ -112,7 +112,7 @@ class ConcatTest : BaseTest() { .concatWith( flowOf(4, 5, 6), flowOf(7, 8, 9), - flowOf(10, 11, 12), + flowOf(10, 11, 12) ) .test((1..12).map { Event.Value(it) } + Event.Complete) @@ -121,7 +121,7 @@ class ConcatTest : BaseTest() { flowOf(4, 5, 6), flowOf(7, 8, 9), flowOf(10, 11, 12), - flowOf(13, 14, 15), + flowOf(13, 14, 15) ) .test((1..15).map { Event.Value(it) } + Event.Complete) @@ -131,7 +131,7 @@ class ConcatTest : BaseTest() { flowOf(7, 8, 9), flowOf(10, 11, 12), flowOf(13, 14, 15), - flowOf(16, 17, 18), + flowOf(16, 17, 18) ).test((1..18).map { Event.Value(it) } + Event.Complete) flowOf(1, 2, 3) @@ -141,7 +141,7 @@ class ConcatTest : BaseTest() { flowOf(7, 8, 9), flowOf(10, 11, 12), flowOf(13, 14, 15), - flowOf(16, 17, 18), + flowOf(16, 17, 18) ) ).test((1..18).map { Event.Value(it) } + Event.Complete) @@ -152,7 +152,7 @@ class ConcatTest : BaseTest() { flowOf(7, 8, 9), flowOf(10, 11, 12), flowOf(13, 14, 15), - flowOf(16, 17, 18), + flowOf(16, 17, 18) ) ).test((1..18).map { Event.Value(it) } + Event.Complete) } @@ -164,20 +164,20 @@ class ConcatTest : BaseTest() { concat( flow1 = flow, - flow2 = flow, + flow2 = flow ).test(events * 2 + Event.Complete) concat( flow1 = flow, flow2 = flow, - flow3 = flow, + flow3 = flow ).test(events * 3 + Event.Complete) concat( flow1 = flow, flow2 = flow, flow3 = flow, - flow4 = flow, + flow4 = flow ).test(events * 4 + Event.Complete) concat( @@ -185,7 +185,7 @@ class ConcatTest : BaseTest() { flow2 = flow, flow3 = flow, flow4 = flow, - flow5 = flow, + flow5 = flow ).test(events * 5 + Event.Complete) concat( @@ -194,7 +194,7 @@ class ConcatTest : BaseTest() { flow, flow, flow, - flow, + flow ).test(events * 6 + Event.Complete) concat( @@ -204,7 +204,7 @@ class ConcatTest : BaseTest() { flow, flow, flow, - flow, + flow ) ).test(events * 6 + Event.Complete) @@ -215,7 +215,7 @@ class ConcatTest : BaseTest() { flow, flow, flow, - flow, + flow ) ).test(events * 6 + Event.Complete) } @@ -231,20 +231,20 @@ class ConcatTest : BaseTest() { concat( flow1 = failureFlow, - flow2 = flow, + flow2 = flow ).test(null, expectation) concat( flow1 = failureFlow, flow2 = flow, - flow3 = flow, + flow3 = flow ).test(null, expectation) concat( flow1 = failureFlow, flow2 = flow, flow3 = flow, - flow4 = flow, + flow4 = flow ).test(null, expectation) concat( @@ -252,7 +252,7 @@ class ConcatTest : BaseTest() { flow2 = flow, flow3 = flow, flow4 = flow, - flow5 = flow, + flow5 = flow ).test(null, expectation) concat( @@ -261,7 +261,7 @@ class ConcatTest : BaseTest() { flow, flow, flow, - flow, + flow ).test(null, expectation) concat( @@ -271,7 +271,7 @@ class ConcatTest : BaseTest() { flow, flow, flow, - flow, + flow ) ).test(null, expectation) @@ -282,7 +282,7 @@ class ConcatTest : BaseTest() { flow, flow, flow, - flow, + flow ) ).test(null, expectation) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/DeferTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/DeferTest.kt index 0c696a3a..b86ea9c9 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/DeferTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/DeferTest.kt @@ -27,11 +27,11 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf -import kotlin.test.Test @ExperimentalCoroutinesApi class DeferTest : BaseTest() { diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/DematerializeTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/DematerializeTest.kt index ae8b4720..5e71fadb 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/DematerializeTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/DematerializeTest.kt @@ -27,6 +27,8 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertFailsWith import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.flow.collect @@ -34,8 +36,6 @@ import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.take -import kotlin.test.Test -import kotlin.test.assertFailsWith @ExperimentalCoroutinesApi @InternalCoroutinesApi @@ -50,7 +50,7 @@ class DematerializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) ) @@ -58,7 +58,7 @@ class DematerializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) .dematerialize() .test( @@ -66,7 +66,7 @@ class DematerializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) ) @@ -77,7 +77,7 @@ class DematerializeTest : BaseTest() { Event.Complete, Event.Value(4), Event.Value(5), - Event.Value(6), + Event.Value(6) ) .dematerialize() .test( @@ -85,7 +85,7 @@ class DematerializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) ) @@ -106,7 +106,7 @@ class DematerializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Error(ex), + Event.Error(ex) ) ) @@ -119,7 +119,7 @@ class DematerializeTest : BaseTest() { concat( flowOf(1, 2, 3), flow { throw ex }, - flowOf(4, 5, 6), + flowOf(4, 5, 6) ) .materialize() .dematerialize() @@ -128,7 +128,7 @@ class DematerializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Error(ex), + Event.Error(ex) ) ) @@ -150,7 +150,7 @@ class DematerializeTest : BaseTest() { .test( listOf( Event.Value(1), - Event.Complete, + Event.Complete ) ) @@ -165,7 +165,7 @@ class DematerializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) ) @@ -178,7 +178,7 @@ class DematerializeTest : BaseTest() { listOf( Event.Value(1), Event.Value(2), - Event.Complete, + Event.Complete ) ) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/EventTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/EventTest.kt index dbd0cac5..bb7126c1 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/EventTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/EventTest.kt @@ -44,15 +44,15 @@ class EventTest { fun valueEventEqualsAndHashCode() { assertEquals( Event.Value(listOf(1, 2, 3)), - Event.Value(listOf(1, 2, 3)), + Event.Value(listOf(1, 2, 3)) ) assertEquals( Event.Value(listOf(1, 2, 3)).hashCode(), - Event.Value(listOf(1, 2, 3)).hashCode(), + Event.Value(listOf(1, 2, 3)).hashCode() ) assertEquals( listOf(1, 2, 3).hashCode(), - Event.Value(listOf(1, 2, 3)).hashCode(), + Event.Value(listOf(1, 2, 3)).hashCode() ) } @@ -70,15 +70,15 @@ class EventTest { val e = TestException() assertEquals( Event.Error(e), - Event.Error(e), + Event.Error(e) ) assertEquals( Event.Error(e).hashCode(), - Event.Error(e).hashCode(), + Event.Error(e).hashCode() ) assertEquals( e.hashCode(), - Event.Error(e).hashCode(), + Event.Error(e).hashCode() ) } @@ -97,7 +97,7 @@ class EventTest { "throws", assertFailsWith { Event.Value(1).map { throw TestException("throws") } - }.message, + }.message ) val errorEvent: Event = Event.Error(TestException("1")) @@ -132,7 +132,7 @@ class EventTest { "throws", assertFailsWith { Event.Value(1).flatMap { throw TestException("throws") } - }.message, + }.message ) val errorEvent: Event = Event.Error(TestException("1")) @@ -153,7 +153,7 @@ class EventTest { listOf( Event.Value(1) to 1, Event.Error(TestException()) to null, - Event.Complete to null, + Event.Complete to null ).forEach { (e, v) -> assertEquals(v, e.valueOrNull()) } @@ -166,7 +166,7 @@ class EventTest { listOf( Event.Value(1) to 1, Event.Error(TestException()) to defaultValue, - Event.Complete to defaultValue, + Event.Complete to defaultValue ).forEach { (e, v) -> assertEquals(v, e.valueOrDefault(defaultValue)) } @@ -211,7 +211,7 @@ class EventTest { listOf( Event.Value(1) to null, Event.Error(exception) to exception, - Event.Complete to null, + Event.Complete to null ).forEach { (e, v) -> assertEquals(v, e.errorOrNull()) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/FlatMapConcatEagerTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/FlatMapConcatEagerTest.kt index bfedfa26..ec483b1f 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/FlatMapConcatEagerTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/FlatMapConcatEagerTest.kt @@ -30,6 +30,10 @@ import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.assertFailsWith import com.hoc081098.flowext.utils.hang import com.hoc081098.flowext.utils.sum +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.CancellationException import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.FlowPreview @@ -49,10 +53,6 @@ import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.yield -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith -import kotlin.time.Duration.Companion.seconds @FlowPreview @ExperimentalCoroutinesApi diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/FlatMapFirstTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/FlatMapFirstTest.kt index f74e004e..1f2f9320 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/FlatMapFirstTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/FlatMapFirstTest.kt @@ -27,6 +27,9 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs import kotlinx.coroutines.CancellationException import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi @@ -37,9 +40,6 @@ import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.take import kotlinx.coroutines.yield -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertIs @ExperimentalCoroutinesApi @InternalCoroutinesApi @@ -56,7 +56,7 @@ class FlatMapFirstTest : BaseTest() { .test( listOf( Event.Value("one"), - Event.Complete, + Event.Complete ) ) } @@ -75,7 +75,7 @@ class FlatMapFirstTest : BaseTest() { 300, 301, 302, 303, 304, 500, 501, 502, 503, 504, 700, 701, 702, 703, 704, - 900, 901, 902, 903, 904, + 900, 901, 902, 903, 904 ).map { Event.Value(it) } + Event.Complete ) } @@ -93,8 +93,13 @@ class FlatMapFirstTest : BaseTest() { .take(7) .test( listOf( - 100, 101, 102, 103, 104, - 300, 301 + 100, + 101, + 102, + 103, + 104, + 300, + 301 ).map { Event.Value(it) } + Event.Complete ) assertEquals(3, input) @@ -158,7 +163,7 @@ class FlatMapFirstTest : BaseTest() { Event.Value(1), Event.Value(1), Event.Value(1), - Event.Complete, + Event.Complete ) ) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/FlowFromSuspendTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/FlowFromSuspendTest.kt index 3dbb6c5c..49cfa796 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/FlowFromSuspendTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/FlowFromSuspendTest.kt @@ -27,9 +27,9 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay -import kotlin.test.Test @ExperimentalCoroutinesApi class FlowFromSuspendTest : BaseTest() { diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/IntervalTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/IntervalTest.kt index 0cc0c4fe..9b44b291 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/IntervalTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/IntervalTest.kt @@ -26,10 +26,10 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.test +import kotlin.test.Test import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.flow.take -import kotlin.test.Test @ExperimentalCoroutinesApi @InternalCoroutinesApi diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/MapIndexedTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/MapIndexedTest.kt index ab222081..2cde5a2c 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/MapIndexedTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/MapIndexedTest.kt @@ -27,15 +27,15 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs import kotlinx.coroutines.CancellationException import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.take -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertIs @InternalCoroutinesApi @ExperimentalCoroutinesApi @@ -50,7 +50,7 @@ class MapIndexedTest : BaseTest() { Event.Value(1 to 2), Event.Value(2 to 3), Event.Value(3 to 4), - Event.Complete, + Event.Complete ) ) } @@ -77,7 +77,7 @@ class MapIndexedTest : BaseTest() { assertEquals( listOf( Event.Value(0 to 0), - Event.Value(1 to 1), + Event.Value(1 to 1) ), it.take(2) ) @@ -91,7 +91,7 @@ class MapIndexedTest : BaseTest() { listOf( Event.Value(0 to 0), Event.Value(1 to 1), - Event.Complete, + Event.Complete ) ) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/MapToTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/MapToTest.kt index 5e4cd68f..63b6b5c3 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/MapToTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/MapToTest.kt @@ -27,14 +27,14 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertEquals import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toList -import kotlin.test.Test -import kotlin.test.assertEquals @ExperimentalCoroutinesApi @InternalCoroutinesApi diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/MaterializeTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/MaterializeTest.kt index cda17546..7bca0771 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/MaterializeTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/MaterializeTest.kt @@ -26,6 +26,9 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException +import kotlin.test.Test +import kotlin.test.assertContentEquals +import kotlin.test.assertEquals import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.flow.emptyFlow @@ -34,9 +37,6 @@ import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.single import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.toList -import kotlin.test.Test -import kotlin.test.assertContentEquals -import kotlin.test.assertEquals @ExperimentalCoroutinesApi @InternalCoroutinesApi @@ -49,9 +49,9 @@ class MaterializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ), - events, + events ) assertEquals(Event.Complete, emptyFlow().materialize().single()) @@ -70,9 +70,9 @@ class MaterializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Error(ex), + Event.Error(ex) ), - events1, + events1 ) val events2 = flowOf(1, 2, 3) @@ -81,13 +81,13 @@ class MaterializeTest : BaseTest() { .toList() assertContentEquals( listOf(Event.Error(ex)), - events2, + events2 ) val events3 = concat( flowOf(1, 2, 3), flow { throw ex }, - flowOf(4, 5, 6), + flowOf(4, 5, 6) ) .materialize() .toList() @@ -96,9 +96,9 @@ class MaterializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Error(ex), + Event.Error(ex) ), - events3, + events3 ) } @@ -108,9 +108,9 @@ class MaterializeTest : BaseTest() { assertContentEquals( listOf( Event.Value(1), - Event.Complete, + Event.Complete ), - events1, + events1 ) val ex = TestException() @@ -124,9 +124,9 @@ class MaterializeTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ), - events2, + events2 ) val events3 = flowOf(1, 2, 3) @@ -138,9 +138,9 @@ class MaterializeTest : BaseTest() { listOf( Event.Value(1), Event.Value(2), - Event.Complete, + Event.Complete ), - events3, + events3 ) } } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/RaceTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/RaceTest.kt index b8aeaf23..f64abbf8 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/RaceTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/RaceTest.kt @@ -27,6 +27,9 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs import kotlinx.coroutines.CancellationException import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay @@ -38,9 +41,6 @@ import kotlinx.coroutines.flow.onCompletion import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.flow.take -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertIs /* * MIT License @@ -93,7 +93,7 @@ class RaceTest : BaseTest() { fun race2WithoutDelay() = runTest { race( flowOf(1, 2).log(1), - flowOf(3, 4).log(2), + flowOf(3, 4).log(2) ).test( listOf( Event.Value(1), @@ -108,7 +108,7 @@ class RaceTest : BaseTest() { race( flowOf(1, 2).onEach { delay(200) }.log(1), flowOf(3, 4).onEach { delay(100) }.log(2), - flowOf(5, 6).onEach { delay(50) }.log(3), + flowOf(5, 6).onEach { delay(50) }.log(3) ).test( listOf( Event.Value(5), @@ -138,7 +138,7 @@ class RaceTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) ) } @@ -238,7 +238,7 @@ class RaceTest : BaseTest() { .test( listOf( Event.Value(1), - Event.Complete, + Event.Complete ) ) } @@ -259,7 +259,7 @@ class RaceTest : BaseTest() { ).test(null) { events -> assertEquals( message, - assertIs(events.single().errorOrThrow()).message, + assertIs(events.single().errorOrThrow()).message ) } } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/RangeTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/RangeTest.kt index d82a49a3..48000c12 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/RangeTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/RangeTest.kt @@ -26,9 +26,9 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.test +import kotlin.test.Test import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi -import kotlin.test.Test @ExperimentalCoroutinesApi @InternalCoroutinesApi @@ -48,7 +48,7 @@ class RangeTest : BaseTest() { Event.Value(2), Event.Value(3), Event.Value(4), - Event.Complete, + Event.Complete ) ) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/RetryWhenWithDelayStrategyTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/RetryWhenWithDelayStrategyTest.kt index ac169f25..a6d60760 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/RetryWhenWithDelayStrategyTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/RetryWhenWithDelayStrategyTest.kt @@ -26,17 +26,17 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.InternalCoroutinesApi -import kotlinx.coroutines.flow.catch -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.flow.fold import kotlin.math.pow import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertIs import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.InternalCoroutinesApi +import kotlinx.coroutines.flow.catch +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.fold @ExperimentalCoroutinesApi @InternalCoroutinesApi @@ -55,13 +55,13 @@ class RetryWhenWithDelayStrategyTest : BaseTest() { flow.retryWhenWithDelayStrategy(DelayStrategy.FixedTimeDelayStrategy(100.milliseconds)) { cause, attempt -> assertEquals( attempt.toString(), - assertIs(cause).message, + assertIs(cause).message ) attempt < retries }.catch { cause -> assertEquals( retries.toString(), - assertIs(cause).message, + assertIs(cause).message ) }.fold(0, Int::plus) assertEquals(4, sum) @@ -100,38 +100,38 @@ class DelayStrategyTest { val strategy = DelayStrategy.ExponentialBackoffDelayStrategy( initialDelay = initialDelay, factor = factor, - maxDelay = maxDelay, + maxDelay = maxDelay ) fun Duration.coerce(): Duration = coerceAtMost(maxDelay) assertEquals( initialDelay.coerce(), - strategy.nextDelay(cause, 0), + strategy.nextDelay(cause, 0) ) assertEquals( (initialDelay * factor).coerce(), - strategy.nextDelay(cause, 1), + strategy.nextDelay(cause, 1) ) assertEquals( (initialDelay * factor * factor).coerce(), - strategy.nextDelay(cause, 2), + strategy.nextDelay(cause, 2) ) assertEquals( (initialDelay * factor * factor * factor).coerce(), - strategy.nextDelay(cause, 3), + strategy.nextDelay(cause, 3) ) assertEquals( (initialDelay * factor * factor * factor * factor).coerce(), - strategy.nextDelay(cause, 4), + strategy.nextDelay(cause, 4) ) assertEquals( (initialDelay * factor * factor * factor * factor * factor).coerce(), - strategy.nextDelay(cause, 5), + strategy.nextDelay(cause, 5) ) assertEquals( (initialDelay * factor.pow(100)).coerce(), - strategy.nextDelay(cause, 100), + strategy.nextDelay(cause, 100) ) } @@ -155,7 +155,7 @@ class DelayStrategyTest { Triple(100.milliseconds, 1.5, 3_000.milliseconds), Triple(100.milliseconds, 1.5, 4_000.milliseconds), Triple(100.milliseconds, 1.5, 5_000.milliseconds), - Triple(100.milliseconds, 1.5, 6_000.milliseconds), + Triple(100.milliseconds, 1.5, 6_000.milliseconds) ).forEach { (a, b, c) -> every(a, b, c) } } } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/StartWithTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/StartWithTest.kt index ebbf25a4..3b4ed983 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/StartWithTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/StartWithTest.kt @@ -26,12 +26,12 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.test -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.flow.flowOf import kotlin.test.Test import kotlin.test.assertFalse import kotlin.test.assertTrue +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.flowOf @ExperimentalCoroutinesApi class StartWithTest : BaseTest() { diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/TakeUntilTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/TakeUntilTest.kt index 83d0f5bc..11972b4c 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/TakeUntilTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/TakeUntilTest.kt @@ -27,6 +27,11 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs +import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.delay @@ -35,11 +40,6 @@ import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.onCompletion import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.take -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertIs -import kotlin.time.Duration.Companion.milliseconds -import kotlin.time.Duration.Companion.seconds @InternalCoroutinesApi @ExperimentalCoroutinesApi @@ -67,7 +67,7 @@ class TakeUntilTest : BaseTest() { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) ) } @@ -111,7 +111,7 @@ class TakeUntilTest : BaseTest() { .test( listOf( Event.Value(1), - Event.Complete, + Event.Complete ) ) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/ThrottleTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/ThrottleTest.kt index 15d3d0b7..5cd71ce2 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/ThrottleTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/ThrottleTest.kt @@ -28,6 +28,12 @@ import com.hoc081098.flowext.ThrottleConfiguration.TRAILING import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertIs +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.CancellationException import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay @@ -41,12 +47,6 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.take import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.advanceTimeBy -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertIs -import kotlin.time.Duration -import kotlin.time.Duration.Companion.milliseconds @ExperimentalCoroutinesApi class ThrottleFirstTest : BaseTest() { @@ -62,7 +62,7 @@ class ThrottleFirstTest : BaseTest() { Event.Value(4), Event.Value(7), Event.Value(10), - Event.Complete, + Event.Complete ) ) } @@ -93,7 +93,7 @@ class ThrottleFirstTest : BaseTest() { Event.Value(1), Event.Value(3), Event.Value(7), - Event.Complete, + Event.Complete ) ) } @@ -136,7 +136,7 @@ class ThrottleFirstTest : BaseTest() { Event.Value(4), Event.Value(null), Event.Value(10), - Event.Complete, + Event.Complete ) ) } @@ -148,7 +148,7 @@ class ThrottleFirstTest : BaseTest() { .test( listOf( Event.Value(1), - Event.Complete, + Event.Complete ) ) } @@ -347,7 +347,7 @@ class ThrottleLastTest : BaseTest() { listOf( Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) ) } @@ -373,7 +373,7 @@ class ThrottleLastTest : BaseTest() { listOf( Event.Value(2), Event.Value(4), - Event.Complete, + Event.Complete ) ) } @@ -400,7 +400,7 @@ class ThrottleLastTest : BaseTest() { Event.Value(2), Event.Value(3), Event.Value(4), - Event.Complete, + Event.Complete ) ) } @@ -443,7 +443,7 @@ class ThrottleLastTest : BaseTest() { Event.Value(6), Event.Value(null), Event.Value(10), - Event.Complete, + Event.Complete ) ) } @@ -455,7 +455,7 @@ class ThrottleLastTest : BaseTest() { .test( listOf( Event.Value(1), - Event.Complete, + Event.Complete ) ) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/TimerTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/TimerTest.kt index b3dc4182..ac14f329 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/TimerTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/TimerTest.kt @@ -27,14 +27,14 @@ package com.hoc081098.flowext import com.hoc081098.flowext.internal.AtomicBoolean import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.time.Duration.Companion.seconds @ExperimentalCoroutinesApi class TimerTest : BaseTest() { @@ -44,7 +44,7 @@ class TimerTest : BaseTest() { .test( listOf( Event.Value(1), - Event.Complete, + Event.Complete ) ) @@ -52,7 +52,7 @@ class TimerTest : BaseTest() { .test( listOf( Event.Value(2), - Event.Complete, + Event.Complete ) ) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/WithLatestFromTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/WithLatestFromTest.kt index 0d82b99e..b2254b2e 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/WithLatestFromTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/WithLatestFromTest.kt @@ -27,6 +27,9 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.BaseTest import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith import kotlinx.coroutines.CancellationException import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi @@ -37,9 +40,6 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.toList -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith @InternalCoroutinesApi @ExperimentalCoroutinesApi @@ -55,7 +55,7 @@ class WithLatestFromTest : BaseTest() { "b" to 4, "c" to 4, "d" to 4, - "e" to 4, + "e" to 4 ) ) } @@ -71,7 +71,7 @@ class WithLatestFromTest : BaseTest() { "b" to null, "c" to null, "d" to null, - "e" to null, + "e" to null ) ) } @@ -85,7 +85,7 @@ class WithLatestFromTest : BaseTest() { listOf( "c" to 1, "d" to 1, - "e" to 1, + "e" to 1 ) ) } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/utils/BaseTest.kt b/src/commonTest/kotlin/com/hoc081098/flowext/utils/BaseTest.kt index bb040b48..a637deee 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/utils/BaseTest.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/utils/BaseTest.kt @@ -24,6 +24,8 @@ package com.hoc081098.flowext.utils +import kotlin.test.assertTrue +import kotlin.test.fail import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect @@ -33,18 +35,16 @@ import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.TestResult import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher -import kotlin.test.assertTrue -import kotlin.test.fail abstract class BaseTest { @ExperimentalCoroutinesApi protected fun runTest( testDispatcher: TestDispatcher? = null, - testBody: suspend TestScope.() -> Unit, + testBody: suspend TestScope.() -> Unit ): TestResult { return kotlinx.coroutines.test.runTest( context = testDispatcher ?: UnconfinedTestDispatcher(name = "${this::class.simpleName}-dispatcher"), - testBody = testBody, + testBody = testBody ) } } diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/utils/NamedDispatchers.kt b/src/commonTest/kotlin/com/hoc081098/flowext/utils/NamedDispatchers.kt index 4b99c974..e57556b4 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/utils/NamedDispatchers.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/utils/NamedDispatchers.kt @@ -24,10 +24,10 @@ package com.hoc081098.flowext.utils -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.Runnable import kotlin.coroutines.CoroutineContext import kotlin.native.concurrent.ThreadLocal +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.Runnable /** * Test dispatchers that emulate multiplatform context tracking. diff --git a/src/commonTest/kotlin/com/hoc081098/flowext/utils/testFlow.kt b/src/commonTest/kotlin/com/hoc081098/flowext/utils/testFlow.kt index 9ada9df3..9d11fae3 100644 --- a/src/commonTest/kotlin/com/hoc081098/flowext/utils/testFlow.kt +++ b/src/commonTest/kotlin/com/hoc081098/flowext/utils/testFlow.kt @@ -26,13 +26,13 @@ package com.hoc081098.flowext.utils import com.hoc081098.flowext.Event import com.hoc081098.flowext.materialize +import kotlin.test.assertContentEquals import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.toList -import kotlin.test.assertContentEquals suspend fun Flow.test( expected: List>?, - expectation: (suspend (List>) -> Unit)? = null, + expectation: (suspend (List>) -> Unit)? = null ) { val events = materialize().toList() expected?.let { assertContentEquals(it, events) } diff --git a/src/jvmTest/kotlin/com/hoc081098/flowext/TakeUntilJvmTest.kt b/src/jvmTest/kotlin/com/hoc081098/flowext/TakeUntilJvmTest.kt index 9bd447e2..bcf36ec6 100644 --- a/src/jvmTest/kotlin/com/hoc081098/flowext/TakeUntilJvmTest.kt +++ b/src/jvmTest/kotlin/com/hoc081098/flowext/TakeUntilJvmTest.kt @@ -26,6 +26,12 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Ignore +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs +import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.delay @@ -35,12 +41,6 @@ import kotlinx.coroutines.flow.onCompletion import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.take import kotlinx.coroutines.runBlocking -import kotlin.test.Ignore -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertIs -import kotlin.time.Duration.Companion.milliseconds -import kotlin.time.Duration.Companion.seconds @Ignore("Ignore JVM tests. Run only locally.") @InternalCoroutinesApi @@ -69,7 +69,7 @@ class TakeUntilJvmTest { Event.Value(1), Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) ) } @@ -113,7 +113,7 @@ class TakeUntilJvmTest { .test( listOf( Event.Value(1), - Event.Complete, + Event.Complete ) ) } diff --git a/src/jvmTest/kotlin/com/hoc081098/flowext/ThrottleJvmTest.kt b/src/jvmTest/kotlin/com/hoc081098/flowext/ThrottleJvmTest.kt index a8621de0..7e01c7b2 100644 --- a/src/jvmTest/kotlin/com/hoc081098/flowext/ThrottleJvmTest.kt +++ b/src/jvmTest/kotlin/com/hoc081098/flowext/ThrottleJvmTest.kt @@ -27,6 +27,14 @@ package com.hoc081098.flowext import com.hoc081098.flowext.ThrottleConfiguration.TRAILING import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import java.util.concurrent.Executors +import kotlin.test.Ignore +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertIs +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.CancellationException import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.asCoroutineDispatcher @@ -41,14 +49,6 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.take import kotlinx.coroutines.runBlocking -import java.util.concurrent.Executors -import kotlin.test.Ignore -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertIs -import kotlin.time.Duration -import kotlin.time.Duration.Companion.milliseconds @Ignore("Ignore JVM tests. Run only locally.") @ExperimentalCoroutinesApi @@ -65,7 +65,7 @@ class ThrottleFirstJvmTest { Event.Value(4), Event.Value(7), Event.Value(10), - Event.Complete, + Event.Complete ) ) } @@ -96,7 +96,7 @@ class ThrottleFirstJvmTest { Event.Value(1), Event.Value(3), Event.Value(7), - Event.Complete, + Event.Complete ) ) } @@ -139,7 +139,7 @@ class ThrottleFirstJvmTest { Event.Value(4), Event.Value(null), Event.Value(10), - Event.Complete, + Event.Complete ) ) } @@ -151,7 +151,7 @@ class ThrottleFirstJvmTest { .test( listOf( Event.Value(1), - Event.Complete, + Event.Complete ) ) } @@ -352,7 +352,7 @@ class ThrottleLastJvmTest { listOf( Event.Value(2), Event.Value(3), - Event.Complete, + Event.Complete ) ) } @@ -378,7 +378,7 @@ class ThrottleLastJvmTest { listOf( Event.Value(2), Event.Value(4), - Event.Complete, + Event.Complete ) ) } @@ -405,7 +405,7 @@ class ThrottleLastJvmTest { Event.Value(2), Event.Value(3), Event.Value(4), - Event.Complete, + Event.Complete ) ) } @@ -448,7 +448,7 @@ class ThrottleLastJvmTest { Event.Value(6), Event.Value(null), Event.Value(10), - Event.Complete, + Event.Complete ) ) } @@ -460,7 +460,7 @@ class ThrottleLastJvmTest { .test( listOf( Event.Value(1), - Event.Complete, + Event.Complete ) ) } diff --git a/src/jvmTest/kotlin/com/hoc081098/flowext/WithLatestFromJvmTest.kt b/src/jvmTest/kotlin/com/hoc081098/flowext/WithLatestFromJvmTest.kt index 0db58e3d..6a764e4a 100644 --- a/src/jvmTest/kotlin/com/hoc081098/flowext/WithLatestFromJvmTest.kt +++ b/src/jvmTest/kotlin/com/hoc081098/flowext/WithLatestFromJvmTest.kt @@ -26,6 +26,10 @@ package com.hoc081098.flowext import com.hoc081098.flowext.utils.TestException import com.hoc081098.flowext.utils.test +import kotlin.test.Ignore +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith import kotlinx.coroutines.CancellationException import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi @@ -37,10 +41,6 @@ import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.toList import kotlinx.coroutines.runBlocking -import kotlin.test.Ignore -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith @Ignore("Ignore JVM tests. Run only locally.") @InternalCoroutinesApi @@ -57,7 +57,7 @@ class WithLatestFromJvmTest { "b" to 4, "c" to 4, "d" to 4, - "e" to 4, + "e" to 4 ) ) } @@ -73,7 +73,7 @@ class WithLatestFromJvmTest { "b" to null, "c" to null, "d" to null, - "e" to null, + "e" to null ) ) } @@ -87,7 +87,7 @@ class WithLatestFromJvmTest { listOf( "c" to 1, "d" to 1, - "e" to 1, + "e" to 1 ) ) } From d1dc943d0237e0f8669f0fbe8c8229c4d85fcdda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petrus=20Nguy=E1=BB=85n=20Th=C3=A1i=20H=E1=BB=8Dc?= Date: Tue, 28 Jun 2022 16:27:30 +0700 Subject: [PATCH 5/5] feat: add Apple Silicon targets --- build.gradle.kts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 11f85eff..159e9fc0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -58,18 +58,22 @@ kotlin { iosArm64() iosArm32() iosX64() + iosSimulatorArm64() macosX64() + macosArm64() mingwX64() linuxX64() tvosX64() + tvosSimulatorArm64() tvosArm64() watchosArm32() watchosArm64() watchosX64() watchosX86() + watchosSimulatorArm64() sourceSets { val commonMain by getting { @@ -112,14 +116,18 @@ kotlin { val appleTargets = listOf( "iosX64", + "iosSimulatorArm64", "iosArm64", "iosArm32", "macosX64", + "macosArm64", "tvosArm64", "tvosX64", + "tvosSimulatorArm64", "watchosArm32", "watchosArm64", "watchosX86", + "watchosSimulatorArm64", "watchosX64" )