Skip to content

Commit

Permalink
link PR in the test
Browse files Browse the repository at this point in the history
als use a bit less memory; it's not really needed to prove the point
  • Loading branch information
folkertdev committed Dec 18, 2024
1 parent 1539a77 commit 5859239
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,11 @@ mod tests {

#[test]
fn terminate_on_drop() {
// Test that dropping the BzEncoder will result in a valid, decompressable datastream
let s = "12345".repeat(100000);
// Test that dropping the BzEncoder flushes bytes to the output, so that
// we get a valid, decompressable datastream
//
// see https://github.com/trifectatechfoundation/bzip2-rs/pull/121
let s = "12345".repeat(100);

let mut compressed = Vec::new();
{
Expand All @@ -413,7 +416,7 @@ mod tests {
d.finish().unwrap()
};
assert_eq!(&uncompressed[0..5], b"12834");
assert_eq!(uncompressed.len(), 500005);
assert_eq!(uncompressed.len(), s.len() + "12834".len());
assert!(format!("12834{}", s).as_bytes() == &*uncompressed);
}
}

0 comments on commit 5859239

Please sign in to comment.