mirror of
https://github.com/jlengrand/ExtraTestModuleExample.git
synced 2026-03-10 08:21:18 +00:00
Adding classes statically
This commit is contained in:
@@ -13,6 +13,18 @@ kotlin {
|
|||||||
val desktopMain by getting
|
val desktopMain by getting
|
||||||
val desktopTest by getting
|
val desktopTest by getting
|
||||||
|
|
||||||
|
val desktopChainTest by creating {
|
||||||
|
kotlin.srcDir("src/desktopChainTest/kotlin")
|
||||||
|
resources.srcDir("src/desktopChainTest/resources")
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
val desktopMainCompilation = kotlin.targets.getByName("desktop").compilations.getByName("main")
|
||||||
|
val desktopChainTestCompilation = kotlin.targets.getByName("desktop").compilations.create("chainTest")
|
||||||
|
desktopChainTestCompilation.defaultSourceSet.dependsOn(desktopChainTest)
|
||||||
|
desktopChainTestCompilation.associateWith(desktopMainCompilation)
|
||||||
|
}
|
||||||
|
|
||||||
commonMain.dependencies {
|
commonMain.dependencies {
|
||||||
implementation(compose.runtime)
|
implementation(compose.runtime)
|
||||||
implementation(compose.foundation)
|
implementation(compose.foundation)
|
||||||
@@ -34,6 +46,11 @@ kotlin {
|
|||||||
implementation(libs.junit5)
|
implementation(libs.junit5)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
desktopChainTest.dependencies {
|
||||||
|
implementation(kotlin("test"))
|
||||||
|
implementation(libs.junit5)
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType<Test> {
|
tasks.withType<Test> {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
@@ -41,6 +58,20 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
tasks.register<Test>("desktopChainTest") {
|
||||||
|
description = "Runs full chain tests"
|
||||||
|
|
||||||
|
val fullChainTestCompilation = kotlin.targets.getByName("desktop").compilations.getByName("chainTest")
|
||||||
|
testClassesDirs = fullChainTestCompilation.output.classesDirs
|
||||||
|
classpath = fullChainTestCompilation.output.classesDirs +
|
||||||
|
fullChainTestCompilation.compileDependencyFiles +
|
||||||
|
fullChainTestCompilation.output.resourcesDir.let { if (it.exists()) files(it) else files() }
|
||||||
|
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
compose.desktop {
|
compose.desktop {
|
||||||
application {
|
application {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package nl.lengrand
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions.*
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
class GreetingTest {
|
||||||
|
@Test
|
||||||
|
fun greet() {
|
||||||
|
|
||||||
|
assertEquals("Hello, you!", Greeting().greet())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user