mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 19:45:29 +00:00
enhance test
Signed-off-by: tommady <tommady@users.noreply.github.com>
This commit is contained in:
parent
f9cf337aa5
commit
fbefb54b02
@ -895,24 +895,22 @@ 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 {
|
||||||
}
|
let mut count = 0;
|
||||||
|
if let Ok(entries) = fs::read_dir(dir) {
|
||||||
fn count_files_recursively(dir: &Path) -> usize {
|
for entry in entries.flatten() {
|
||||||
let mut count = 0;
|
let path = entry.path();
|
||||||
// println!("{:?}", dir);
|
if path.is_file() {
|
||||||
if let Ok(entries) = fs::read_dir(dir) {
|
count += 1;
|
||||||
for entry in entries.flatten() {
|
} else if path.is_dir() {
|
||||||
let path = entry.path();
|
count += count_files_recursively(&path);
|
||||||
if path.is_file() {
|
}
|
||||||
// println!("{:?}", path);
|
|
||||||
count += 1;
|
|
||||||
} else if path.is_dir() {
|
|
||||||
count += count_files_recursively(&path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
count
|
||||||
}
|
}
|
||||||
count
|
|
||||||
|
assert_eq!(20, count_files_recursively(&out_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user