1 use crate::template::Context;
2 use crate::utils::recursively_copy;
6 pub fn archive(archive_directory: &Path, _: &Path, target: &Path, _: &Context) -> Result<()> {
7 if archive_directory.exists() {
8 return recursively_copy(archive_directory, target);
15 use std::collections::HashMap;
16 use std::fs::create_dir_all;
20 use test_utilities::*;
23 fn test_copies_files() {
24 let test_dir = setup_test_dir();
25 let archive_dir = test_dir.join("archive");
26 let output_dir = test_dir.join("output");
27 create_dir_all(&archive_dir).expect("Could not create archive test directory");
28 create_dir_all(&output_dir).expect("Could not create output test directory");
30 create_test_file(&archive_dir.join("🤠"), "beep boop boop beep");
32 let context: Context = HashMap::new();
34 archive(&archive_dir, &test_dir, &output_dir, &context).expect("Archive failed");
36 assert_file_contents(&output_dir.join("🤠"), "beep boop boop beep");
40 fn test_ignores_if_no_archive() {
41 let test_dir = setup_test_dir();
42 let archive_dir = test_dir.join("archive");
43 let output_dir = test_dir.join("output");
45 let context: Context = HashMap::new();
47 archive(&archive_dir, &test_dir, &output_dir, &context).expect("Archive failed");