use super::Scratch;
#[test]
fn a_scratch_is_unique_and_is_removed_when_it_drops() {
let first = Scratch::new();
let second = Scratch::new();
assert_ne!(first.path(), second.path());
assert!(first.path().is_dir());
let path = first.join("inside");
std::fs::write(&path, b"something").expect("write");
let held = first.path().to_path_buf();
drop(first);
assert!(!held.exists(), "the scratch outlived its value");
assert!(second.path().is_dir(), "and took nothing else with it");
}
#[test]
fn join_names_a_path_and_dir_makes_one() {
let scratch = Scratch::new();
assert!(!scratch.join("absent").exists());
let made = scratch.dir("present");
assert!(made.is_dir());
assert_eq!(made, scratch.join("present"));
}