Skip to content

Commit

Permalink
Fix for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tesujimath committed Jun 27, 2024
1 parent f86e6a2 commit 7c9da71
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ where
let unc_path = convert_disk_to_unc(&abs_path);
let unc_expected = convert_disk_to_unc(&abs_expected);

let other_dir = tempdir().unwrap();
farm.run_without(
let cwd = tempdir().unwrap();
with_cwd(cwd).run(
|path| {
let actual = f(path);
// if we ascended out of the farm rootdir it's not straightforward to verify the logical path
Expand All @@ -339,7 +339,6 @@ where
);
},
unc_path.as_path(),
other_dir,
);
}

Expand Down Expand Up @@ -442,7 +441,7 @@ where
abs_path.as_path(),
);

test_is_real_root_with_unc_path(farm, &abs_path, expected);
test_is_real_root_with_unc_path(&abs_path, expected);
}

// check is_real_root() succeeds with expected, with both absolute and relative paths
Expand All @@ -464,25 +463,24 @@ where
}

#[cfg(target_family = "windows")]
fn test_is_real_root_with_unc_path<P>(farm: &LinkFarm, abs_path: P, expected: bool)
fn test_is_real_root_with_unc_path<P>(abs_path: P, expected: bool)
where
P: AsRef<Path> + Debug,
{
let unc_path = convert_disk_to_unc(&abs_path);

let other_dir = tempdir().unwrap();
farm.run_without(
let cwd = tempdir().unwrap();
with_cwd(cwd).run(
|path| {
let actual = path.is_real_root();
is_expected_ok(unc_path.as_path(), actual, expected);
},
unc_path.as_path(),
other_dir,
);
}

#[cfg(target_family = "unix")]
fn test_is_real_root_with_unc_path<P>(_farm: &LinkFarm, _abs_path: P, _expected: bool)
fn test_is_real_root_with_unc_path<P>(_abs_path: P, _expected: bool)
where
P: AsRef<Path> + Debug,
{
Expand Down

0 comments on commit 7c9da71

Please sign in to comment.