Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Sep 18, 2024
1 parent 7969d06 commit e76adae
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions yazi-shared/src/fs/fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,22 @@ async fn test_symlink_realpath() {
fs::symlink("/tmp/issue-1173/b", "/tmp/issue-1173/D").await.unwrap();
fs::symlink("real-dir", "/tmp/issue-1173/link-dir").await.unwrap();

async fn check(a: &str, b: &str) {
assert_eq!(symlink_realname2(Path::new(a)).await.ok(), Some(OsStr::new(b).into()));
let c = &mut HashMap::new();
async fn check(a: &str, b: &str, c: &mut HashMap<PathBuf, HashSet<OsString>>) {
assert_eq!(symlink_realname(Path::new(a), c).await.ok(), Some(OsStr::new(b).into()));
}

check("/tmp/issue-1173/a", "A").await;
check("/tmp/issue-1173/A", "A").await;
check("/tmp/issue-1173/a", "A", c).await;
check("/tmp/issue-1173/A", "A", c).await;

check("/tmp/issue-1173/b", "b").await;
check("/tmp/issue-1173/B", "b").await;
check("/tmp/issue-1173/b", "b", c).await;
check("/tmp/issue-1173/B", "b", c).await;

check("/tmp/issue-1173/link-dir/c", "C").await;
check("/tmp/issue-1173/link-dir/C", "C").await;
check("/tmp/issue-1173/link-dir/c", "C", c).await;
check("/tmp/issue-1173/link-dir/C", "C", c).await;

check("/tmp/issue-1173/d", "D").await;
check("/tmp/issue-1173/D", "D").await;
check("/tmp/issue-1173/d", "D", c).await;
check("/tmp/issue-1173/D", "D", c).await;
}

// realpath(3) without resolving symlinks. This is useful for case-insensitive
Expand Down

0 comments on commit e76adae

Please sign in to comment.