Skip to content

Commit ce9f6de

Browse files
committed
Add ending zip comment reading/writing test
1 parent e012985 commit ce9f6de

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/tests/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,25 @@ async fn zero_length_zip() {
3232
assert!(zip_reader_res.is_err());
3333
}
3434

35+
#[tokio::test]
36+
async fn single_entry_with_comment() {
37+
use crate::read::seek::ZipFileReader;
38+
39+
let comment = "Foo bar.";
40+
let mut input_stream = Cursor::new(Vec::<u8>::new());
41+
let mut zip_writer = ZipFileWriter::new(&mut input_stream);
42+
43+
zip_writer.comment(String::from(comment));
44+
zip_writer.close().await.expect("failed to close writer");
45+
46+
input_stream.set_position(0);
47+
48+
let zip_reader_res = ZipFileReader::new(&mut input_stream).await.expect("failed to open reader");
49+
50+
assert!(zip_reader_res.comment().is_some());
51+
assert_eq!(zip_reader_res.comment().unwrap(), comment);
52+
}
53+
3554
#[tokio::test]
3655
async fn single_entry_no_data() {
3756
use crate::read::seek::ZipFileReader;

0 commit comments

Comments
 (0)