diff --git a/README.adoc b/README.adoc index b9b4e56..a4b2967 100644 --- a/README.adoc +++ b/README.adoc @@ -2,8 +2,8 @@ :toc: preamble :toclevels: 3 :icons: font -:version: 1.2.0 -:ksp-version: 1.6.0-1.0.2 +:version: 1.3.0 +:ksp-version: 1.6.0-1.0.4 A Kotlin/Multiplatform Kotlin Symbol Processor that generates Mocks & Fakes. diff --git a/build.gradle.kts b/build.gradle.kts index e1cb2a4..445da46 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ plugins { id("org.kodein.root") - id("com.google.devtools.ksp") version "1.6.10-1.0.2" apply false + id("com.google.devtools.ksp") version "1.6.10-1.0.4" apply false } -val kspVersion by extra { "1.6.10-1.0.2" } +val kspVersion by extra { "1.6.10-1.0.4" } allprojects { group = "org.kodein.mock" - version = "1.2.0" + version = "1.3.0" } diff --git a/mockmp-gradle-plugin/src/main/kotlin/org/kodein/mock/gradle/MocKMPGradlePlugin.kt b/mockmp-gradle-plugin/src/main/kotlin/org/kodein/mock/gradle/MocKMPGradlePlugin.kt index 9fe6788..a5f74fc 100644 --- a/mockmp-gradle-plugin/src/main/kotlin/org/kodein/mock/gradle/MocKMPGradlePlugin.kt +++ b/mockmp-gradle-plugin/src/main/kotlin/org/kodein/mock/gradle/MocKMPGradlePlugin.kt @@ -29,11 +29,11 @@ class MocKMPGradlePlugin : Plugin { kotlin.sourceSets.getByName("commonTest") { if (jvmTarget.isAndroid) { this.kotlin.srcDirs( - "build/generated/ksp/${jvmTarget.name}DebugUnitTest/kotlin", - "build/generated/ksp/${jvmTarget.name}ReleaseUnitTest/kotlin" + "build/generated/ksp/${jvmTarget.name}/${jvmTarget.name}DebugUnitTest/kotlin", + "build/generated/ksp/${jvmTarget.name}/${jvmTarget.name}ReleaseUnitTest/kotlin" ) } else { - this.kotlin.srcDir("build/generated/ksp/${jvmTarget.name}Test/kotlin") + this.kotlin.srcDir("build/generated/ksp/${jvmTarget.name}/${jvmTarget.name}Test/kotlin") } dependencies { implementation("org.kodein.mock:mockmp-runtime:${BuildConfig.VERSION}") @@ -66,13 +66,13 @@ class MocKMPGradlePlugin : Plugin { afterEvaluate { tasks.named("kspDebugUnitTestKotlin${jvmTarget.name.capitalize()}") { doFirst { - delete("build/generated/ksp/${jvmTarget.name}ReleaseUnitTest/kotlin") + delete("build/generated/ksp/${jvmTarget.name}/${jvmTarget.name}ReleaseUnitTest/kotlin") } } tasks.named("kspReleaseUnitTestKotlin${jvmTarget.name.capitalize()}") { doFirst { - delete("build/generated/ksp/${jvmTarget.name}DebugUnitTest/kotlin") + delete("build/generated/ksp/${jvmTarget.name}/${jvmTarget.name}DebugUnitTest/kotlin") } } } diff --git a/tests/build.gradle.kts b/tests/build.gradle.kts index bcbd777..fe8a79f 100644 --- a/tests/build.gradle.kts +++ b/tests/build.gradle.kts @@ -13,7 +13,7 @@ kodein { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0") } // Adding KSP JVM result to COMMON source set - kotlin.srcDir("build/generated/ksp/jvmTest/kotlin") + kotlin.srcDir("build/generated/ksp/jvm/jvmTest/kotlin") } add(kodeinTargets.jvm.jvm) diff --git a/tests/src/commonTest/kotlin/tests/VerificationTests.kt b/tests/src/commonTest/kotlin/tests/VerificationTests.kt index 7b3353e..d1bf8d4 100644 --- a/tests/src/commonTest/kotlin/tests/VerificationTests.kt +++ b/tests/src/commonTest/kotlin/tests/VerificationTests.kt @@ -346,4 +346,19 @@ class VerificationTests { bar.doSomething() } } + + @Test + fun testOverrideToString() { + val foo = MockFoo(mocker) + + val answers = ArrayList() + mocker.every { foo.doInt(isAny(capture = answers)) } returns Unit + mocker.every { foo.toString() } runs { "Answer is ${answers.last()}!" } + foo.doInt(42) + assertEquals("Answer is 42!", foo.toString()) + mocker.verify { + foo.doInt(42) + foo.toString() + } + } }