Mercurial > hg-stable
changeset 46245:db2bc9e667a1
rust: fix testing with $TMPDIR ≠ /tmp
Differential Revision: https://phab.mercurial-scm.org/D9670
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Tue, 29 Dec 2020 23:15:26 +0100 |
parents | fb69b51b4daa |
children | 416ecdaa12df |
files | rust/hg-core/src/utils/path_auditor.rs |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/utils/path_auditor.rs Mon Jan 11 15:16:36 2021 +0100 +++ b/rust/hg-core/src/utils/path_auditor.rs Tue Dec 29 23:15:26 2020 +0100 @@ -206,6 +206,7 @@ let base_dir = tempdir().unwrap(); let base_dir_path = base_dir.path(); + let skip = base_dir_path.components().count() - 1; let a = base_dir_path.join("a"); let b = base_dir_path.join("b"); create_dir(&a).unwrap(); @@ -215,7 +216,7 @@ // TODO make portable std::os::unix::fs::symlink(&a, &b).unwrap(); - let buf = b.join("in_a").components().skip(2).collect::<PathBuf>(); + let buf = b.join("in_a").components().skip(skip).collect::<PathBuf>(); eprintln!("buf: {}", buf.display()); let path = path_to_hg_path_buf(buf).unwrap(); assert_eq!(