Skip to content

Commit

Permalink
file-info: use vec pathbuf in tests
Browse files Browse the repository at this point in the history
Co-authored-by: Cavonstavant <[email protected]>
  • Loading branch information
majent4 and Cavonstavant authored Feb 12, 2024
1 parent 5d4d31e commit a23c63c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/file_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ pub fn create_file_info(path: &PathBuf) -> Option<FileInfo> {
..Default::default()
})
}
Err(_) => None,
Err(err) => {
warn!("Could not get access to {} metadata: {}", path, err);
None
},
}
}

Expand All @@ -154,14 +157,14 @@ mod tests {

#[test]
fn test_get_file_signature() {
let path = PathBuf::from("tests/assets/test_folder/test-file-1");
let path = PathBuf::from(vec![r"tests", r"assets", r"test_folder", r"test-file-1"].iter().collect());
let hash = get_file_signature(&path);
assert_eq!(hash, 53180848542178601830765469314885156230);
}

#[test]
fn test_create_file_info() {
let path = PathBuf::from("tests/assets/test_folder/test-file-1");
let path = PathBuf::from(vec![r"tests", r"assets", r"test_folder", r"test-file-1"].iter().collect());
if let Some(file_info) = create_file_info(&path) {
assert_eq!(file_info.path, path);
assert_eq!(file_info.size, 100);
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub async fn run() {

let mut tidy_algo = TidyAlgo::new();
info!("TidyAlgo sucessfully created");
tidy_algo.load_rules_from_file(&my_files, PathBuf::from("config/rules/basic.yml"));
tidy_algo.load_rules_from_file(&my_files, PathBuf::from(vec![r"config", r"rules", r"basic.yml"].iter().collect()));
info!("TidyAlgo sucessfully loaded rules from config/rules/basic.yml");

list_directories(config.file_lister_config.dir, &my_files);
Expand Down

0 comments on commit a23c63c

Please sign in to comment.