Skip to content

Commit

Permalink
#360: Fix unit test OS-specific data
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Jun 26, 2024
1 parent dbae98f commit 9c83a1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/scan/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3196,7 +3196,7 @@ mod tests {
mod game_layout {
use pretty_assertions::assert_eq;

use crate::testing::{drives_x_always, repo_file_raw};
use crate::testing::{drives_x_always, drives_x_static, repo_file_raw};

use super::*;

Expand Down Expand Up @@ -3581,12 +3581,12 @@ mod tests {

let before = IndividualMapping {
name: "migrate-legacy-backup".to_string(),
drives: drives_x_always(),
drives: drives_x_static(),
..Default::default()
};
let after = IndividualMapping {
name: "migrate-legacy-backup".to_string(),
drives: drives_x_always(),
drives: drives_x_static(),
backups: VecDeque::from(vec![FullBackup {
name: ".".into(),
files: btree_map! {
Expand Down Expand Up @@ -3617,7 +3617,7 @@ mod tests {
fn can_migrate_initial_empty_backup() {
let before = IndividualMapping {
name: "migrate-initial-empty-backup".to_string(),
drives: drives_x_always(),
drives: drives_x_static(),
backups: VecDeque::from(vec![FullBackup {
name: ".".into(),
children: VecDeque::from(vec![DifferentialBackup {
Expand All @@ -3639,7 +3639,7 @@ mod tests {
};
let after = IndividualMapping {
name: "migrate-initial-empty-backup".to_string(),
drives: drives_x_always(),
drives: drives_x_static(),
backups: VecDeque::from(vec![FullBackup {
name: "backup-20240626T100614Z-diff".into(),
when: chrono::DateTime::<chrono::FixedOffset>::parse_from_rfc3339("2024-06-26T10:06:14.120957700Z")
Expand Down
4 changes: 4 additions & 0 deletions src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ pub fn drives_x_always() -> BTreeMap<String, String> {
}
}

pub fn drives_x_static() -> BTreeMap<String, String> {
btree_map! { "drive-X".into(): "X:".into() }
}

pub fn make_original_path(file: &str) -> StrictPath {
StrictPath::new(format!("{}{file}", if cfg!(target_os = "windows") { "X:" } else { "" }))
}
Expand Down

0 comments on commit 9c83a1e

Please sign in to comment.