Skip to content

Commit

Permalink
tests: add unbound compressed text
Browse files Browse the repository at this point in the history
  • Loading branch information
Uinelj committed Aug 3, 2023
1 parent dacec85 commit 8e06aa3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/v3/writer/new_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,28 @@ mod test {
}
}

#[test]
fn test_unbound_compressed() {
let dir = tempdir().unwrap();
let stem = "test".to_string();
let mut w = Writer::new(dir.path(), stem, Some(Comp::Zstd { level: 0 }), None).unwrap();
let data = vec!["test\n", "data\n", ":)\n"];

for d in &data {
w.write_all(d.as_bytes()).unwrap();
}
w.flush().unwrap();

let p = w.current_filepath();
std::mem::drop(w);

let f = File::open(p).unwrap();
let dec = zstd::decode_all(f).unwrap();
let res = String::from_utf8(dec).unwrap();

assert_eq!(res, data.join(""))
}

#[test]
// We bound each file to 5 bytes of data
// We should have the following result:
Expand Down

0 comments on commit 8e06aa3

Please sign in to comment.