mod common;
use std::fs;
use std::path::Path;
fn setup_clyde(clyde_home: &Path) {
common::run_clyde(clyde_home, &["setup"]);
}
fn is_dir_empty(dir: &Path) -> bool {
let mut iter = fs::read_dir(dir).unwrap();
iter.next().is_none()
}
#[test]
fn install_removes_downloaded_archive() {
let temp_dir = assert_fs::TempDir::new().unwrap();
let clyde_home = temp_dir.join("clyde");
setup_clyde(&clyde_home);
let download_dir = clyde_home.join("download");
assert!(download_dir.is_dir());
assert!(is_dir_empty(&download_dir));
common::run_clyde(&clyde_home, &["install", "starship"]);
assert!(is_dir_empty(&download_dir));
}