-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
63 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 6 additions & 8 deletions
14
app/src/test/java/com/droidknights/app2023/ExampleUnitTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
package com.droidknights.app2023 | ||
|
||
import org.junit.Test | ||
|
||
import org.junit.Assert.* | ||
import io.kotest.core.spec.style.StringSpec | ||
import io.kotest.matchers.shouldBe | ||
|
||
/** | ||
* Example local unit test, which will execute on the development machine (host). | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
class ExampleUnitTest { | ||
@Test | ||
fun addition_isCorrect() { | ||
assertEquals(4, 2 + 2) | ||
class ExampleUnitTest : StringSpec({ | ||
"addition is correct" { | ||
4 shouldBe 2 + 2 | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ internal class HiltKotlinPlugin : Plugin<Project> { | |
configureHiltKotlin() | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
build-logic/src/main/kotlin/com/droidknights/app2023/KotestAndroid.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.droidknights.app2023 | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
internal fun Project.configureKotestAndroid() { | ||
configureKotest() | ||
configureJUnitAndroid() | ||
} | ||
|
||
internal fun Project.configureJUnitAndroid() { | ||
androidExtension.apply { | ||
testOptions { | ||
unitTests.all { it.useJUnitPlatform() } | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
build-logic/src/main/kotlin/com/droidknights/app2023/KotestKotlin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.droidknights.app2023 | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.tasks.testing.Test | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.gradle.kotlin.dsl.withType | ||
|
||
internal fun Project.configureKotest() { | ||
configureJUnit() | ||
val libs = extensions.libs | ||
dependencies { | ||
"testImplementation"(libs.findLibrary("kotest.runner").get()) | ||
"testImplementation"(libs.findLibrary("kotest.assertions").get()) | ||
} | ||
} | ||
|
||
internal fun Project.configureJUnit() { | ||
tasks.withType<Test>().configureEach { | ||
useJUnitPlatform() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters