Skip to content

Commit f8dbf26

Browse files
committed
Support windows paths in FormatterTestFactory
1 parent ffd022a commit f8dbf26

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

core/src/test/java/org/jetbrains/ktfmt/FormatterTestFactory.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.jetbrains.ktfmt
33
import com.facebook.ktfmt.format.Formatter
44
import com.facebook.ktfmt.format.FormattingOptions
55
import com.facebook.ktfmt.format.TrailingCommaManagementStrategy
6+
import java.net.URI
67
import java.nio.file.Path
78
import kotlin.io.path.extension
89
import kotlin.io.path.isDirectory
@@ -12,7 +13,6 @@ import kotlin.io.path.name
1213
import kotlin.io.path.nameWithoutExtension
1314
import kotlin.io.path.readText
1415
import kotlin.io.path.writeText
15-
import kotlin.io.resolve
1616
import org.junit.jupiter.api.Assertions.assertEquals
1717
import org.junit.jupiter.api.DynamicContainer
1818
import org.junit.jupiter.api.DynamicNode
@@ -62,7 +62,7 @@ abstract class FormatterTestFactory(
6262
// Without this, neither 'overwrite' nor navigation in IJ will work
6363
val root = run {
6464
val location = javaClass.protectionDomain?.codeSource?.location!!
65-
val root = location.toURI().path.substringBefore("build/classes/kotlin/test")
65+
val root = URI(location.toURI().toString().substringBefore("build/classes/kotlin/test"))
6666
Path.of(root).resolve("src/test/resources/cases")
6767
}
6868
}

0 commit comments

Comments
 (0)