Skip to content

Commit

Permalink
Add test to verify things work with hard links present.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Emann committed May 28, 2024
1 parent c7d2e75 commit f1ee9f7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/applesauce/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,4 +515,18 @@ mod tests {
let dir = TempDir::new().unwrap();
compress_folder(compressor::Kind::Lzfse, dir.path());
}

#[test]
fn compress_with_hardlinks() {
let dir = TempDir::new().unwrap();
let orig_file = dir.path().join("test1.txt");
fs::write(&orig_file, b"fooooooobaaaaar").unwrap();
fs::hard_link(&orig_file, dir.path().join("test2.txt")).unwrap();

let orig_contents = recursive_read(dir.path());
let mut fc = FileCompressor::new();
fc.recursive_compress([dir.path()], Kind::default(), 2.0, 2, &NoProgress, false);
let next_contents = recursive_read(dir.path());
assert_entries_equal(&orig_contents, &next_contents);
}
}

0 comments on commit f1ee9f7

Please sign in to comment.