Revert "Always use a tempdir for caches during tests"

This reverts commit 6572b46983.
This commit is contained in:
Richard Feldman 2022-11-20 11:10:51 -05:00
parent 6572b46983
commit a6c0bd854f
No known key found for this signature in database
GPG Key ID: F1F21AA5B1D9E43B
3 changed files with 1 additions and 12 deletions

1
Cargo.lock generated
View File

@ -4009,7 +4009,6 @@ dependencies = [
"pretty_assertions",
"roc_parse",
"tar",
"tempfile",
"ureq",
"walkdir",
]

View File

@ -22,6 +22,4 @@ bumpalo.workspace = true
[dev-dependencies]
pretty_assertions = "1.3.0"
indoc = "1.0.7"
tempfile.workspace = true
indoc = "1.0.7"

View File

@ -78,7 +78,6 @@ const ROC_CACHE_DIR_NAME: &str = "roc";
///
/// Returns None if XDG_CACHE_HOME is not set, and also we can't determine the home directory
/// (or if %APPDATA% is missing on Windows) on this system.
#[cfg(not(test))]
pub fn roc_cache_dir(roc_version: &str) -> Option<PathBuf> {
// Respect XDG, if the system appears to be using it.
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
@ -107,10 +106,3 @@ pub fn roc_cache_dir(roc_version: &str) -> Option<PathBuf> {
}
}
}
#[cfg(test)]
pub fn roc_cache_dir(_: &str) -> Option<PathBuf> {
// Always use a tempdir during tests. We never want to write to the user's
// actual cache directory during tests!
Some(tempfile::temp_dir().unwrap())
}