enhance test

Signed-off-by: tommady <tommady@users.noreply.github.com>
This commit is contained in:
tommady 2025-05-22 06:41:30 +00:00
parent f9cf337aa5
commit fbefb54b02
No known key found for this signature in database
GPG Key ID: 175B664929DF2F2F

View File

@ -895,17 +895,12 @@ fn unpack_multiple_sources_into_the_same_destination_with_merge(
.assert() .assert()
.success(); .success();
assert_eq!(20, count_files_recursively(&out_path)); fn count_files_recursively(dir: &Path) -> usize {
}
fn count_files_recursively(dir: &Path) -> usize {
let mut count = 0; let mut count = 0;
// println!("{:?}", dir);
if let Ok(entries) = fs::read_dir(dir) { if let Ok(entries) = fs::read_dir(dir) {
for entry in entries.flatten() { for entry in entries.flatten() {
let path = entry.path(); let path = entry.path();
if path.is_file() { if path.is_file() {
// println!("{:?}", path);
count += 1; count += 1;
} else if path.is_dir() { } else if path.is_dir() {
count += count_files_recursively(&path); count += count_files_recursively(&path);
@ -913,6 +908,9 @@ fn count_files_recursively(dir: &Path) -> usize {
} }
} }
count count
}
assert_eq!(20, count_files_recursively(&out_path));
} }
#[test] #[test]