some test edit
parent
dc70c3ca7a
commit
2076ebd6f4
|
|
@ -620,4 +620,32 @@ mod edit {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_edit {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_build_empty() {
|
||||
tests::with_dir(|d| {
|
||||
build_dir(&d, &Files { files: vec![] }).expect("failed to build empty dir");
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_build_with_files() {
|
||||
tests::with_dir(|d1| {
|
||||
tests::write_file(&d1, "file_a", "hello world a");
|
||||
tests::write_file(&d1, "file_b", "hello world b");
|
||||
let p1 = d1.path().join("file_a").display().to_string();
|
||||
let p2 = d1.path().join("file_b").display().to_string();
|
||||
let files = Files::new(&vec![p1, p2]);
|
||||
tests::with_dir(|d2| {
|
||||
build_dir(&d2, &files).expect("failed to build non-empty dir");
|
||||
tests::file_contains(&d2, "file_a", "hello world a");
|
||||
tests::file_contains(&d2, "file_b", "hello world b");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue