Skip to content

Commit

Permalink
fs: Add a regression test for #93384
Browse files Browse the repository at this point in the history
  • Loading branch information
tavianator committed Jan 29, 2022
1 parent f8f4c40 commit d0c8b29
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions library/std/src/fs/tests.rs
Expand Up @@ -1504,3 +1504,19 @@ fn create_dir_long_paths() {
let path = Path::new("");
assert_eq!(path.canonicalize().unwrap_err().kind(), crate::io::ErrorKind::NotFound);
}

/// Ensure ReadDir works on large directories.
/// Regression test for https://github.com/rust-lang/rust/issues/93384.
#[test]
fn read_large_dir() {
let tmpdir = tmpdir();

let count = 32 * 1024;
for i in 0..count {
check!(fs::File::create(tmpdir.join(&i.to_string())));
}

for entry in fs::read_dir(tmpdir.path()).unwrap() {
entry.unwrap();
}
}

0 comments on commit d0c8b29

Please sign in to comment.