From f0268721c16f8c4287c046622fb809bfb28b9d3b Mon Sep 17 00:00:00 2001 From: Brian Norman Date: Wed, 14 Feb 2024 07:49:59 -0600 Subject: [PATCH] [PowerAssert] Use OS path separator to parse JUnit5 classpath property --- plugins/power-assert/build.gradle.kts | 2 +- .../org/jetbrains/kotlin/powerassert/JunitTestServices.kt | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/power-assert/build.gradle.kts b/plugins/power-assert/build.gradle.kts index 1f4163f7577..e4c8d0889b0 100644 --- a/plugins/power-assert/build.gradle.kts +++ b/plugins/power-assert/build.gradle.kts @@ -49,6 +49,6 @@ projectTest(parallel = true) { val localJunit5Classpath: FileCollection = junit5Classpath doFirst { - systemProperty("junit5.classpath", localJunit5Classpath.files.joinToString(",") { it.absolutePath }) + systemProperty("junit5.classpath", localJunit5Classpath.asPath) } } diff --git a/plugins/power-assert/test/org/jetbrains/kotlin/powerassert/JunitTestServices.kt b/plugins/power-assert/test/org/jetbrains/kotlin/powerassert/JunitTestServices.kt index 0e271bb3d70..08ecb74ccc2 100644 --- a/plugins/power-assert/test/org/jetbrains/kotlin/powerassert/JunitTestServices.kt +++ b/plugins/power-assert/test/org/jetbrains/kotlin/powerassert/JunitTestServices.kt @@ -14,7 +14,8 @@ import org.jetbrains.kotlin.test.services.RuntimeClasspathProvider import org.jetbrains.kotlin.test.services.TestServices import java.io.File -private val junit5Classpath = System.getProperty("junit5.classpath").split(",") +private val junit5Classpath = System.getProperty("junit5.classpath")?.split(File.pathSeparator)?.map(::File) + ?: error("Unable to get a valid classpath from 'junit5.classpath' property") fun TestConfigurationBuilder.enableJunit() { useConfigurators(::JunitEnvironmentConfigurator) @@ -24,7 +25,7 @@ fun TestConfigurationBuilder.enableJunit() { class JunitEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) { override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule) { if (PowerAssertConfigurationDirectives.WITH_JUNIT5 in module.directives) { - for (file in junit5Classpath.map { File(it) }) { + for (file in junit5Classpath) { configuration.addJvmClasspathRoot(file) } } @@ -34,7 +35,7 @@ class JunitEnvironmentConfigurator(testServices: TestServices) : EnvironmentConf class JunitRuntimeClassPathProvider(testServices: TestServices) : RuntimeClasspathProvider(testServices) { override fun runtimeClassPaths(module: TestModule): List { if (PowerAssertConfigurationDirectives.WITH_JUNIT5 in module.directives) { - return junit5Classpath.map { File(it) } + return junit5Classpath } else { return emptyList() }