Skip to content

Commit

Permalink
Use absolute() instead of toAbsolutePath()
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed Apr 27, 2024
1 parent aec3016 commit ff6c6a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Expand Up @@ -9,12 +9,13 @@ import org.jetbrains.kotlin.psi.psiUtil.findDescendantOfType
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
import kotlin.io.path.Path
import kotlin.io.path.absolute
import kotlin.io.path.relativeToOrSelf
import kotlin.io.path.toPath

class EntitySpec {

private val path = Path("src/test/resources/EntitySpecFixture.kt").toAbsolutePath()
private val path = Path("src/test/resources/EntitySpecFixture.kt").absolute()
private val basePath = EntitySpec::class.java.getResource("/")!!.toURI().toPath()
private val relativePath = path.relativeToOrSelf(basePath)
private val code = compileForTest(path)
Expand Down
Expand Up @@ -34,9 +34,9 @@ internal class CliArgsSpec {
@Test
fun `the current working directory is used if parameter is not set`() {
val spec = parseArguments(emptyArray()).toSpec()
val workingDir = Path("").toAbsolutePath()
val workingDir = Path("").absolute()

assertThat(spec.projectSpec.inputPaths).allSatisfy { it.toAbsolutePath().startsWith(workingDir) }
assertThat(spec.projectSpec.inputPaths).allSatisfy { it.absolute().startsWith(workingDir) }
assertThat(spec.projectSpec.inputPaths).contains(pathBuildGradle)
assertThat(spec.projectSpec.inputPaths).contains(pathCliArgs)
assertThat(spec.projectSpec.inputPaths).contains(pathCliArgsSpec)
Expand Down
Expand Up @@ -11,6 +11,7 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
import kotlin.io.path.Path
import kotlin.io.path.absolute

class FormattingRuleSpec {

Expand Down Expand Up @@ -69,7 +70,7 @@ class FormattingRuleSpec {

@Test
fun `#3063_ formatting issues have an absolute path`() {
val expectedPath = Path("src/test/resources/configTests/chain-wrapping-before.kt").toAbsolutePath()
val expectedPath = Path("src/test/resources/configTests/chain-wrapping-before.kt").absolute()

val rule = ChainWrapping(Config.empty)
val findings = rule.visitFile(compileForTest(expectedPath))
Expand Down

0 comments on commit ff6c6a1

Please sign in to comment.