mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fix relative path tests
They'd fail when the current working directory was on a different drive to the default temporary directory.
This commit is contained in:
+2
-2
@@ -904,7 +904,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn should_succeed_if_given_a_relative_game_path() {
|
||||
let fixture = Fixture::new(GameType::TES3);
|
||||
let fixture = Fixture::in_path(GameType::TES3, Path::new("target"));
|
||||
|
||||
let game_path = make_relative(&fixture.game_path);
|
||||
assert!(game_path.is_relative());
|
||||
@@ -972,7 +972,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn should_succeed_if_given_relative_paths() {
|
||||
let fixture = Fixture::new(GameType::TES4);
|
||||
let fixture = Fixture::in_path(GameType::TES3, Path::new("target"));
|
||||
|
||||
let game_path = make_relative(&fixture.game_path);
|
||||
assert!(game_path.is_relative());
|
||||
|
||||
@@ -179,6 +179,20 @@ impl Fixture {
|
||||
.prefix("libloot-t\u{00E9}st-")
|
||||
.tempdir()
|
||||
.unwrap();
|
||||
|
||||
Self::with_tempdir(game_type, temp_dir)
|
||||
}
|
||||
|
||||
pub fn in_path(game_type: GameType, in_path: &Path) -> Fixture {
|
||||
let temp_dir = tempfile::Builder::new()
|
||||
.prefix("libloot-t\u{00E9}st-")
|
||||
.tempdir_in(in_path)
|
||||
.unwrap();
|
||||
|
||||
Self::with_tempdir(game_type, temp_dir)
|
||||
}
|
||||
|
||||
fn with_tempdir(game_type: GameType, temp_dir: TempDir) -> Fixture {
|
||||
let root_path = temp_dir.path();
|
||||
let game_path = root_path.join("games/game");
|
||||
let local_path = root_path.join("local/game");
|
||||
|
||||
Reference in New Issue
Block a user