0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 17:34:47 -05:00

fix: test_create_cache_if_dir_not_exit (#4636)

This test doesn't remove created directory after test. It will fail on next run.
This commit is contained in:
Yusuke Sakurai 2020-04-06 23:08:53 +09:00 committed by GitHub
parent 1e478d73e3
commit b9e5e4c7ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -146,11 +146,10 @@ mod tests {
#[test] #[test]
fn test_create_cache_if_dir_not_exits() { fn test_create_cache_if_dir_not_exits() {
let cache_location = if cfg!(target_os = "windows") { let temp_dir = TempDir::new().unwrap();
PathBuf::from(r"C:\deno_dir\foo") let mut cache_location = temp_dir.path().to_owned();
} else { assert!(fs::remove_dir(&cache_location).is_ok());
PathBuf::from("~/deno_dir/foo") cache_location.push("foo");
};
assert_eq!(cache_location.is_dir(), false); assert_eq!(cache_location.is_dir(), false);
DiskCache::new(&cache_location); DiskCache::new(&cache_location);
assert_eq!(cache_location.is_dir(), true); assert_eq!(cache_location.is_dir(), true);