Skip to content

Commit 908ea79

Browse files
DK26tesuji
authored andcommitted
test: Add failing test for verbatim prefix paths (#30)
1 parent 76f0d75 commit 908ea79

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/tests.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,22 @@ fn get_target_user_dirs() {
245245
other => panic!("target path is not a junction point: {:?}", other),
246246
}
247247
}
248+
249+
#[test]
250+
fn create_with_verbatim_prefix_paths() {
251+
// Regression test for https://github.com/tesuji/junction/issues/30
252+
let tmpdir = create_tempdir();
253+
254+
let target = tmpdir.path().join("target");
255+
let link_parent = tmpdir.path().join("links");
256+
fs::create_dir_all(&target).unwrap();
257+
fs::create_dir_all(&link_parent).unwrap();
258+
259+
// std::fs::canonicalize() returns paths with \\?\ verbatim prefix on Windows
260+
let target = fs::canonicalize(&target).unwrap();
261+
let junction = fs::canonicalize(&link_parent).unwrap().join("junction");
262+
263+
super::create(&target, &junction).unwrap();
264+
assert!(super::exists(&junction).unwrap(), "junction should exist");
265+
assert_eq!(super::get_target(&junction).unwrap(), target);
266+
}

0 commit comments

Comments
 (0)