Skip to content

Commit d0c8b29

Browse files
committed
fs: Add a regression test for rust-lang#93384
1 parent f8f4c40 commit d0c8b29

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

library/std/src/fs/tests.rs

+16
Original file line numberDiff line numberDiff line change
@@ -1504,3 +1504,19 @@ fn create_dir_long_paths() {
15041504
let path = Path::new("");
15051505
assert_eq!(path.canonicalize().unwrap_err().kind(), crate::io::ErrorKind::NotFound);
15061506
}
1507+
1508+
/// Ensure ReadDir works on large directories.
1509+
/// Regression test for https://github.com/rust-lang/rust/issues/93384.
1510+
#[test]
1511+
fn read_large_dir() {
1512+
let tmpdir = tmpdir();
1513+
1514+
let count = 32 * 1024;
1515+
for i in 0..count {
1516+
check!(fs::File::create(tmpdir.join(&i.to_string())));
1517+
}
1518+
1519+
for entry in fs::read_dir(tmpdir.path()).unwrap() {
1520+
entry.unwrap();
1521+
}
1522+
}

0 commit comments

Comments
 (0)