+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ target
.project
.cargo
.settings
test_data/links/link-f
test_data/links/link-d
test_data/links/link-*
222 changes: 222 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ description = "Rust implementation of GNU findutils"
authors = ["uutils developers"]

[dependencies]
chrono = "0.4"
glob = "0.3"
walkdir = "2.3"
tempfile = "3"
regex = "1.5"
once_cell = "1.9"
uucore = { git = "https://github.com/uutils/coreutils", features = ["entries", "fs", "fsext"] }

[dev-dependencies]
assert_cmd = "2"
filetime = "0.2"
predicates = "2"
serial_test = "0.5"

Expand Down
8 changes: 4 additions & 4 deletions src/find/matchers/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Matcher for DeleteMatcher {

#[cfg(test)]
mod tests {
use std::fs::File;
use std::fs::{create_dir, File};
use tempfile::Builder;

use super::*;
Expand All @@ -79,6 +79,7 @@ mod tests {

let temp_dir_path = temp_dir.path().to_string_lossy();
File::create(temp_dir.path().join("test")).expect("created test file");
create_dir(temp_dir.path().join("test_dir")).expect("created test directory");
let test_entry = get_dir_entry_for(&temp_dir_path, "test");
assert!(
matcher.matches(&test_entry, &mut deps.new_matcher_io()),
Expand All @@ -89,14 +90,13 @@ mod tests {
"DeleteMatcher should actually delete files it matches",
);

let temp_dir_name = temp_dir.path().file_name().unwrap().to_string_lossy();
let temp_dir_entry = get_dir_entry_for(&temp_dir_path, &temp_dir_name);
let temp_dir_entry = get_dir_entry_for(&temp_dir_path, "test_dir");
assert!(
matcher.matches(&temp_dir_entry, &mut deps.new_matcher_io()),
"DeleteMatcher should match directories",
);
assert!(
!temp_dir.path().exists(),
!temp_dir.path().join("test_dir").exists(),
"DeleteMatcher should actually delete (empty) directories it matches",
);
}
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载