Skip to content

Commit f8332a7

Browse files
fzhinkinSpace Team
authored andcommitted
KT-81478 FileTreeWalkTest.withDirectoryFilter test
withDirectoryFilter filters out all directories having a name that ends with "3". Previously, root directory would always have a ".tmp" prefix, but after switching to createTempDirectory, the directory name is a sequence of digits, and the last one may be "3". The fix changes a filtration condition in the test to explicitly traverse a root directory. ^KT-81478 fixed
1 parent 7e3716c commit f8332a7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libraries/stdlib/jvm/test/io/FileTreeWalks.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ class FileTreeWalkTest {
210210
@Test fun withDirectoryFilter() {
211211
val basedir = createTestFiles()
212212
try {
213-
// Every directory ended with 3 and its content is filtered out
214-
fun filter(file: File): Boolean = !file.name.endsWith("3")
213+
// Every directory ended with 3 and its content is filtered out.
214+
// The root directory itself may have a name ending with 3, so let's explicitly keep it.
215+
fun filter(file: File): Boolean = !file.name.endsWith("3") || basedir.name == file.name
215216

216217
val referenceNames = listOf("", "1", "1/2", "6", "7.txt", "8", "8/9.txt").map { File(it).path }.toSet()
217218
compareWalkResults(referenceNames, basedir, ::filter)

0 commit comments

Comments
 (0)