-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
194db6e
commit f27c1dd
Showing
3 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/PluginUtilTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.jlleitschuh.gradle.ktlint | ||
|
||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.io.TempDir | ||
import java.io.File | ||
|
||
internal class PluginUtilTest { | ||
@TempDir | ||
lateinit var temporaryFolder: File | ||
|
||
@Test | ||
fun `test isRootEditorConfig returns true`() { | ||
temporaryFolder.resolve("test-pos.txt").apply { | ||
createNewFile() | ||
writeText( | ||
""" | ||
root=true | ||
""".trimIndent() | ||
) | ||
Assertions.assertTrue(this.toPath().isRootEditorConfig()) { | ||
"correctly detects root" | ||
} | ||
delete() | ||
} | ||
} | ||
|
||
@Test | ||
fun `test isRootEditorConfig returns false`() { | ||
temporaryFolder.resolve("test-neg.txt").apply { | ||
createNewFile() | ||
writeText( | ||
""" | ||
[*.kt] | ||
""".trimIndent() | ||
) | ||
Assertions.assertFalse(this.toPath().isRootEditorConfig()) { | ||
"correctly does not match non-root file" | ||
} | ||
delete() | ||
} | ||
} | ||
} |