diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 1989f10..72090ba 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -13,6 +13,18 @@ kotlin { val desktopMain 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 { implementation(compose.runtime) implementation(compose.foundation) @@ -34,6 +46,11 @@ kotlin { implementation(libs.junit5) } + desktopChainTest.dependencies { + implementation(kotlin("test")) + implementation(libs.junit5) + } + tasks.withType { useJUnitPlatform() } @@ -41,6 +58,20 @@ kotlin { } } +afterEvaluate { + tasks.register("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 { application { diff --git a/composeApp/src/desktopChainTest/kotlin/nl/lengrand/GreetingTest.kt b/composeApp/src/desktopChainTest/kotlin/nl/lengrand/GreetingTest.kt new file mode 100644 index 0000000..4709c39 --- /dev/null +++ b/composeApp/src/desktopChainTest/kotlin/nl/lengrand/GreetingTest.kt @@ -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()) + } + +} \ No newline at end of file