Skip to content

Commit

Permalink
Add test which breaks on WindowsOS
Browse files Browse the repository at this point in the history
This test succeeds on MacOs, and according to OP of #2781 it breaks on Windows OS. Verify whether this test also breaks in build pipeline.
  • Loading branch information
paul-dingemans committed Aug 28, 2024
1 parent b898462 commit 572e94e
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,28 @@ internal class FileUtilsTest {
)
}

@Test
fun `Issue 2781 - Find files with correct glob for wildcards`() {
val ktFileInProjectOutsideFlavoredDirectoryWithOverlappingName = "project1/src/mock/kotlin/TestOneSetup.kt"
val ktFileInProjectFlavoredDirectoryWithoutOverlappingName = "project1/src/testMock/kotlin/TwoTest.kt"

ktlintTestFileSystem.createFile(ktFileInProjectOutsideFlavoredDirectoryWithOverlappingName)
ktlintTestFileSystem.createFile(ktFileInProjectFlavoredDirectoryWithoutOverlappingName)

val foundFiles =
getFiles(
patterns = listOf("**/test*/**"),
rootDir = ktlintTestFileSystem.resolve(ktFileInProjectRootDirectory).parent.toAbsolutePath(),
)

assertThat(foundFiles)
.containsExactlyInAnyOrder(
ktFileInProjectFlavoredDirectoryWithoutOverlappingName,
).doesNotContain(
ktFileInProjectOutsideFlavoredDirectoryWithOverlappingName,
)
}

private fun KtlintTestFileSystem.createFile(fileName: String) =
writeFile(
relativeDirectoryToRoot = fileName.substringBeforeLast("/", ""),
Expand Down

0 comments on commit 572e94e

Please sign in to comment.