Skip to content

Commit

Permalink
♻️ use unwrap in test function solid_entry
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanTsune committed Aug 11, 2024
1 parent d822efd commit fde9873
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions lib/src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,25 +307,27 @@ mod tests {
}

#[test]
fn solid_entry() -> Result<(), Box<dyn std::error::Error>> {
fn solid_entry() {
let archive = {
let mut writer = Archive::write_header(Vec::new())?;
let mut writer = Archive::write_header(Vec::new()).unwrap();
let dir_entry = {
let builder = EntryBuilder::new_dir("test".into());
builder.build().unwrap()
};
let file_entry = {
let options = WriteOptions::builder().build();
let mut builder = EntryBuilder::new_file("test/text".into(), options)?;
builder.write_all("text".as_bytes())?;
builder.build()?
};
writer.add_entry({
let mut builder = SolidEntryBuilder::new(WriteOptions::builder().build()).unwrap();
builder.add_entry(dir_entry).unwrap();
builder.add_entry(file_entry).unwrap();
let options = WriteOptions::store();
let mut builder = EntryBuilder::new_file("test/text".into(), options).unwrap();
builder.write_all("text".as_bytes()).unwrap();
builder.build().unwrap()
})?;
};
writer
.add_entry({
let mut builder = SolidEntryBuilder::new(WriteOptions::store()).unwrap();
builder.add_entry(dir_entry).unwrap();
builder.add_entry(file_entry).unwrap();
builder.build().unwrap()
})
.unwrap();
writer.finalize().unwrap()
};

Expand All @@ -334,7 +336,6 @@ mod tests {
entries.next().unwrap().expect("failed to read entry");
entries.next().unwrap().expect("failed to read entry");
assert!(entries.next().is_none());
Ok(())
}

#[test]
Expand Down

0 comments on commit fde9873

Please sign in to comment.