Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Kotest Multiplatform plug-in #3141

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions arrow-libs/core/arrow-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
alias(libs.plugins.arrowGradleConfig.kotlin)
alias(libs.plugins.arrowGradleConfig.publish)
alias(libs.plugins.kotlinx.kover)
alias(libs.plugins.kotest.multiplatform)
// alias(libs.plugins.kotest.multiplatform)
alias(libs.plugins.spotless)
}

Expand All @@ -33,16 +33,17 @@ kotlin {
commonTest {
dependencies {
implementation(projects.arrowFxCoroutines)
implementation(kotlin("test"))
implementation(libs.kotest.frameworkEngine)
implementation(libs.kotest.assertionsCore)
implementation(libs.kotest.property)
}
}

jvmTest {
dependencies {
runtimeOnly(libs.kotest.runnerJUnit5)
}
// dependencies {
// runtimeOnly(libs.kotest.runnerJUnit5)
// }
}

jvmMain {
Expand Down Expand Up @@ -71,3 +72,7 @@ kotlin {
tasks.named<KotlinCompile>("compileTestKotlinJvm") {
kotlinOptions.freeCompilerArgs += "-Xcontext-receivers"
}

tasks.test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ package arrow.core

import arrow.core.test.functionAToB
import arrow.core.test.stackSafeIteration
import io.kotest.core.spec.style.StringSpec
import io.kotest.property.Arb
import io.kotest.matchers.shouldBe
import io.kotest.property.arbitrary.int
import io.kotest.property.arbitrary.list
import io.kotest.property.checkAll
import kotlinx.coroutines.test.runTest
import kotlin.test.Test

class AndThenTests : StringSpec({
class AndThenTests {
val count = stackSafeIteration()

"AndThen0 - compose a chain of functions with andThen should be same with AndThen" {
@Test fun andThen0composeChain() = runTest {
checkAll(Arb.int(), Arb.list(Arb.functionAToB<Int, Int>(Arb.int()))) { i, fs ->
val result = fs.fold({ i }) { acc, f ->
{ f(acc()) }
Expand All @@ -26,15 +27,15 @@ class AndThenTests : StringSpec({
}
}

"AndThen0 - andThen is stack safe" {
@Test fun andThen0stackSafe() {
val result = (0 until count).fold({ 0 }) { acc, _ ->
acc.andThen { it + 1 }
}.invoke()

result shouldBe count
}

"AndThen1 - compose a chain of functions with andThen should be same with AndThen" {
@Test fun andThen1composeChain() = runTest {
checkAll(Arb.int(), Arb.list(Arb.functionAToB<Int, Int>(Arb.int()))) { i, fs ->
val result = fs.fold({ x: Int -> x }) { acc, f ->
{ x: Int -> f(acc(x)) }
Expand All @@ -48,7 +49,7 @@ class AndThenTests : StringSpec({
}
}

"AndThen1 - compose a chain of function with compose should be same with AndThen" {
@Test fun composeComposeChain() = runTest {
checkAll(Arb.int(), Arb.list(Arb.functionAToB<Int, Int>(Arb.int()))) { i, fs ->
val result = fs.fold({ x: Int -> x }) { acc, f ->
{ x: Int -> acc(f(x)) }
Expand All @@ -62,23 +63,23 @@ class AndThenTests : StringSpec({
}
}

"AndThen1 - andThen is stack safe" {
@Test fun andThen1stackSafe() {
val result = (0 until count).fold({ x: Int -> x }) { acc, _ ->
acc.andThen { it + 1 }
}.invoke(0)

result shouldBe count
}

"AndThen1 - compose is stack safe" {
@Test fun composeStackSafe() {
val result = (0 until count).fold({ x: Int -> x }) { acc, _ ->
acc.compose { it + 1 }
}.invoke(0)

result shouldBe count
}

"AndThen2 - compose a chain of functions with andThen should be same with AndThen" {
@Test fun andThen2composeChain() = runTest {
checkAll(Arb.int(), Arb.int(), Arb.list(Arb.functionAToB<Int, Int>(Arb.int()))) { i, j, fs ->
val result = fs.fold({ x: Int, y: Int -> x + y }) { acc, f ->
{ x: Int, y: Int -> f(acc(x, y)) }
Expand All @@ -92,11 +93,11 @@ class AndThenTests : StringSpec({
}
}

"AndThen2 - andThen is stack safe" {
@Test fun andThen2stackSafe() = runTest {
val result = (0 until count).fold({ x: Int, y: Int -> x + y }) { acc, _ ->
acc.andThen { it + 1 }
}.invoke(0, 0)

result shouldBe count
}
})
}
Loading
Loading