use std::path::Path;
use anyhow::Context;
use cp_r::CopyOptions;
#[test]
fn attach_anyhow_context_to_success() {
let dest = tempfile::tempdir().unwrap();
let stats = CopyOptions::new()
.copy_tree(Path::new("src"), dest.path())
.context("copy src dir for test")
.unwrap();
dbg!(&stats);
}
#[test]
fn attach_anyhow_context_to_failure() {
let dest = tempfile::tempdir().unwrap();
let err = CopyOptions::new()
.create_destination(false)
.copy_tree(Path::new("src"), dest.path().join("nonexistent"))
.context("copy src dir for test")
.unwrap_err();
dbg!(&err);
println!("Display error: {}", err);
}