Skip to content

Commit

Permalink
Add a unit test which passes on Linux but fails on Windows (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
hlerchl committed Oct 11, 2023
1 parent cf3bcf7 commit 857992b
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,37 @@ class KtlintPluginTest : AbstractPluginTest() {
}
}

@DisplayName("Should ignore excluded sources which are generated during build")
@CommonTest
fun ignoreExcludedSourcesGeneratedByBuild(gradleVersion: GradleVersion) {
project(gradleVersion) {
withCleanSources()

//language=Groovy
buildGradle.appendText(
"""
ktlint.filter { exclude { it.file.path.contains("Failing") } }
task createExtraFile() {
def rootDir = project.getRootDir().toString()
def fileDir = rootDir + "/src/main/kotlin"
def fileName = "FailingSource.kt"
doLast {
file(fileDir).mkdirs()
file(fileDir + "/" + fileName) << "val foo = \"bar\"\n"
}
}
${CHECK_PARENT_TASK_NAME}.dependsOn createExtraFile
""".trimIndent()
)

build(CHECK_PARENT_TASK_NAME) {
assertThat(task(":$mainSourceSetCheckTaskName")?.outcome).isEqualTo(TaskOutcome.SUCCESS)
}
}
}

@DisplayName("Should fail on additional source set directories files style violation")
@CommonTest
fun additionalSourceSetsViolations(gradleVersion: GradleVersion) {
Expand Down

0 comments on commit 857992b

Please sign in to comment.