Skip to content

Commit

Permalink
Update to KSP 1.0.4 & bump MocKMP to 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SalomonBrys committed Mar 8, 2022
1 parent 2b83f31 commit 7146652
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class MocKMPGradlePlugin : Plugin<Project> {
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}")
Expand Down Expand Up @@ -66,13 +66,13 @@ class MocKMPGradlePlugin : Plugin<Project> {
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")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions tests/src/commonTest/kotlin/tests/VerificationTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,19 @@ class VerificationTests {
bar.doSomething()
}
}

@Test
fun testOverrideToString() {
val foo = MockFoo<Bar>(mocker)

val answers = ArrayList<Int>()
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()
}
}
}

0 comments on commit 7146652

Please sign in to comment.