Skip to content

Commit

Permalink
tests: check case insensitive file symlink (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuja committed Nov 7, 2024
1 parent cbb4c81 commit 6abe72c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/tests/test_local_working_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ fn check_icase_fs(dir: &Path) -> bool {
dir.join(upper_name).try_exists().unwrap()
}

fn check_icase_file_symlink(dir: &Path) -> bool {
let temp_dir = tempfile::Builder::new()
.prefix("icase-")
.tempdir_in(dir)
.unwrap();
let symlink_name = "symlink";
std::fs::write(temp_dir.path().join("file"), "").unwrap();
try_symlink("file", temp_dir.path().join(symlink_name)).unwrap();
match temp_dir.path().join(symlink_name.to_ascii_uppercase()).symlink_metadata() {
Ok(_) => true,
Err(err) if err.kind() == std::io::ErrorKind::NotFound => false,
Err(err) => panic!("{err}"),
}
}

/// Returns true if the directory appears to ignore some unicode zero-width
/// characters, as in HFS+.
fn check_hfs_plus(dir: &Path) -> bool {
Expand Down Expand Up @@ -1322,6 +1337,7 @@ fn test_check_out_existing_file_symlink_icase_fs(victim_exists: bool) {
let repo = &test_workspace.repo;
let workspace_root = test_workspace.workspace.workspace_root().to_owned();
let is_icase_fs = check_icase_fs(&workspace_root);
dbg!(check_icase_file_symlink(&workspace_root)); // XXX

// Creates a symlink in working directory, and a tree that will overwrite
// the symlink content.
Expand Down

0 comments on commit 6abe72c

Please sign in to comment.