Skip to content

Commit

Permalink
Add test for grouping transformed files
Browse files Browse the repository at this point in the history
  • Loading branch information
pkolaczk committed Jun 11, 2022
1 parent 4616994 commit b930014
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,29 @@ mod test {
});
}

#[test]
#[cfg(unix)]
fn transformed_truncated() {
with_dir("target/test/group/transform/truncate/", |root| {
let input_path_1 = root.join("input1.txt");
let input_path_2 = root.join("input2.txt");
// the files are different and have different lengths, but their initial
// 2 bytes are the same
write_file(&input_path_1, "aa|1");
write_file(&input_path_2, "aa|23456");

let log = test_log();
let mut config = GroupConfig::default();
config.paths = vec![input_path_1.into(), input_path_2.into()];
// a transform that takes only the first two bytes of each file
config.transform = Some("dd count=2 bs=1".to_string());

let results = group_files(&config, &log).unwrap();
assert_eq!(results.len(), 1);
assert_eq!(results[0].files.len(), 2);
})
}

#[test]
fn report() {
with_dir("main/report", |root| {
Expand Down

0 comments on commit b930014

Please sign in to comment.