Skip to content

Commit ef0be36

Browse files
committed
Rework unittest
1 parent 24cdc1b commit ef0be36

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

std/file.d

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5192,21 +5192,22 @@ auto dirEntries(bool useDIP1000 = dip1000Enabled)
51925192
chdir(root);
51935193
scope(exit) chdir(origWD);
51945194

5195-
// When issue #9584 is triggered,
5196-
// one of the `isDir` calls fails with "No such file or directory".
5197-
foreach (string entry; ".".dirEntries(SpanMode.shallow))
5195+
/*
5196+
This wouldn't work if `entry` were a `string` – for obvious reasons:
5197+
One cannot (reliably) iterate nested directory trees using relative path strings
5198+
while changing directories in between.
5199+
5200+
The expected error would be something along the lines of:
5201+
> Failed to stat file `./3/5': No such file or directory
5202+
5203+
See <https://github.com/dlang/phobos/issues/9584> for further details.
5204+
*/
5205+
foreach (DirEntry entry; ".".dirEntries(SpanMode.shallow))
51985206
{
51995207
if (entry.isDir)
5200-
{
5201-
foreach (string subEntry; entry.dirEntries(SpanMode.shallow))
5202-
{
5208+
foreach (DirEntry subEntry; entry.dirEntries(SpanMode.shallow))
52035209
if (subEntry.isDir)
5204-
{
5205-
chdir(subEntry.absolutePath);
5206-
assert(subEntry.absolutePath);
5207-
}
5208-
}
5209-
}
5210+
chdir(subEntry.absolutePath); //
52105211
}
52115212
}
52125213

0 commit comments

Comments
 (0)