refactor(monorepo): remove env restore from workspace test

This commit is contained in:
2026-09-17 09:55:24 -04:00
parent 5c077fe3c6
commit 3170d1668d

View File

@@ -1,33 +1,9 @@
use std::ffi::OsString;
use std::path::PathBuf;
use monorepo::workspace::resolve_workspace_path;
const BUILD_WORKSPACE_DIRECTORY: &str = "BUILD_WORKSPACE_DIRECTORY";
struct EnvRestore {
value: Option<OsString>,
}
impl EnvRestore {
fn capture() -> Self {
Self {
value: std::env::var_os(BUILD_WORKSPACE_DIRECTORY),
}
}
}
impl Drop for EnvRestore {
fn drop(&mut self) {
unsafe {
if let Some(value) = &self.value {
std::env::set_var(BUILD_WORKSPACE_DIRECTORY, value);
} else {
std::env::remove_var(BUILD_WORKSPACE_DIRECTORY);
}
}
}
}
#[derive(Debug)]
struct Case {
@@ -39,8 +15,6 @@ struct Case {
#[test]
fn resolve_workspace_path_cases() {
let _restore = EnvRestore::capture();
let cases = [
Case {
name: "absolute path returns unchanged path",