Skip to content

Commit 2ef545d

Browse files
hlerchlwakingrufus
authored andcommitted
Add a unit test which passes on Linux but fails on Windows (JLLeitschuh#715)
1 parent 431af6b commit 2ef545d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/KtlintPluginTest.kt

+31
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,37 @@ class KtlintPluginTest : AbstractPluginTest() {
196196
}
197197
}
198198

199+
@DisplayName("Should ignore excluded sources which are generated during build")
200+
@CommonTest
201+
fun ignoreExcludedSourcesGeneratedByBuild(gradleVersion: GradleVersion) {
202+
project(gradleVersion) {
203+
withCleanSources()
204+
205+
//language=Groovy
206+
buildGradle.appendText(
207+
"""
208+
ktlint.filter { exclude { it.file.path.contains("Failing") } }
209+
210+
task createExtraFile() {
211+
def rootDir = project.getRootDir().toString()
212+
def fileDir = rootDir + "/src/main/kotlin"
213+
def fileName = "FailingSource.kt"
214+
doLast {
215+
file(fileDir).mkdirs()
216+
file(fileDir + "/" + fileName) << "val foo = \"bar\"\n"
217+
}
218+
}
219+
220+
${CHECK_PARENT_TASK_NAME}.dependsOn createExtraFile
221+
""".trimIndent()
222+
)
223+
224+
build(CHECK_PARENT_TASK_NAME) {
225+
assertThat(task(":$mainSourceSetCheckTaskName")?.outcome).isEqualTo(TaskOutcome.SUCCESS)
226+
}
227+
}
228+
}
229+
199230
@DisplayName("Should fail on additional source set directories files style violation")
200231
@CommonTest
201232
fun additionalSourceSetsViolations(gradleVersion: GradleVersion) {

0 commit comments

Comments
 (0)