I tried adding an integration test, but I couldn't get the path because build_dir() and all related methods are private. This doesn't really seem like a unit test, but I can add it if you like.
Also, it seems like rustwide runs cargo clean without arguments during tests? I'd really rather it didn't do that, if I use a shared CARGO_TARGET_DIR it means I have to rebuild rustwide (and all other crates) from scratch for every test. Instead it could call cargo clean -p <package>.
use failure::Error;
const WORKSPACE_NAME: &str = "test-drop";
#[test]
fn test_build_dir_drop() -> Result<(), Error> {
let workspace = crate::utils::init_named_workspace(WORKSPACE_NAME)?;
let mut build_dir = workspace.build_dir("drop-dir");
build_dir.purge_on_drop(true);
let path = build_dir.build_dir();
drop(build_dir);
assert!(!path.exists());
Ok(())
}
I tried adding an integration test, but I couldn't get the path because
build_dir()
and all related methods are private. This doesn't really seem like a unit test, but I can add it if you like.Also, it seems like rustwide runs
cargo clean
without arguments during tests? I'd really rather it didn't do that, if I use a shared CARGO_TARGET_DIR it means I have to rebuild rustwide (and all other crates) from scratch for every test. Instead it could callcargo clean -p <package>
.