Skip to content

Commit

Permalink
chore: fix cache tests for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nokazn committed Apr 16, 2024
1 parent c535caa commit b0e51d8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ mod tests {

use crate::{
test_each,
utils::{fs::exists_dir, path::to_absolute_path, result::convert_panic_to_result},
utils::{
fs::exists_dir,
path::{clean_path_separator, to_absolute_path},
result::convert_panic_to_result,
},
};

struct CacheNewTestCase {
Expand All @@ -194,7 +198,16 @@ mod tests {
let result = convert_panic_to_result(|| {
if case.expected.is_ok() {
assert!(cache.is_ok());
assert_eq!(cache.as_ref().unwrap(), &case.expected.unwrap());
let cache = cache.as_ref().unwrap();
let expected = &case.expected.unwrap();
assert_eq!(clean_path_separator(&cache.base_dir), expected.base_dir);
assert_eq!(clean_path_separator(&cache.target_dir), expected.target_dir);
assert_eq!(clean_path_separator(&cache.cache_dir), expected.cache_dir);
assert_eq!(cache.metadata.contents, expected.metadata.contents);
assert_eq!(
clean_path_separator(&cache.metadata.file_path),
expected.metadata.file_path
);
} else {
assert!(cache.is_err());
}
Expand Down

0 comments on commit b0e51d8

Please sign in to comment.