X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/b17907faf8d9693cef94a6048d802bd4ced9102f..9c537e473ac117eadad86b68d21f3aaf8d8937c4:/src/archiver/raw.rs?ds=sidebyside diff --git a/src/archiver/raw.rs b/src/archiver/raw.rs index ce7ecb7..5cac709 100644 --- a/src/archiver/raw.rs +++ b/src/archiver/raw.rs @@ -9,3 +9,41 @@ pub fn archive(archive_directory: &Path, _: &Path, target: &Path, _: &Context) - } Ok(()) } + +#[cfg(test)] +mod tests { + use std::collections::HashMap; + use std::fs::create_dir_all; + + use super::*; + + use test_utilities::*; + + #[test] + fn test_copies_files() { + let test_dir = setup_test_dir(); + let archive_dir = test_dir.join("archive"); + let output_dir = test_dir.join("output"); + create_dir_all(&archive_dir).expect("Could not create archive test directory"); + create_dir_all(&output_dir).expect("Could not create output test directory"); + + create_test_file(&archive_dir.join("🤠"), "beep boop boop beep"); + + let context: Context = HashMap::new(); + + archive(&archive_dir, &test_dir, &output_dir, &context).expect("Archive failed"); + + assert_file_contents(&output_dir.join("🤠"), "beep boop boop beep"); + } + + #[test] + fn test_ignores_if_no_archive() { + let test_dir = setup_test_dir(); + let archive_dir = test_dir.join("archive"); + let output_dir = test_dir.join("output"); + + let context: Context = HashMap::new(); + + archive(&archive_dir, &test_dir, &output_dir, &context).expect("Archive failed"); + } +}