Skip to content

Commit 0d01598

Browse files
committed
tests: add integration test using a Zip file to trigger Seek
Signed-off-by: Otavio Salvador <[email protected]>
1 parent 535da55 commit 0d01598

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

tests/fixtures/test.zip

960 Bytes
Binary file not shown.

tests/integration_test.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,63 @@ fn successfully_list_archive_files() {
147147
);
148148
}
149149

150+
#[test]
151+
fn list_archive_zip() {
152+
let source = std::fs::File::open("tests/fixtures/test.zip").unwrap();
153+
154+
assert_eq!(
155+
list_archive_files(source).unwrap(),
156+
vec![
157+
"content/".to_string(),
158+
"content/first".to_string(),
159+
"content/third".to_string(),
160+
"content/nested/".to_string(),
161+
"content/nested/second".to_string(),
162+
],
163+
"file list inside the archive did not match"
164+
);
165+
}
166+
167+
#[async_std::test]
168+
#[cfg(feature = "futures_support")]
169+
async fn list_archive_zip_futures() {
170+
let source = async_std::fs::File::open("tests/fixtures/test.zip")
171+
.await
172+
.unwrap();
173+
174+
assert_eq!(
175+
futures_support::list_archive_files(source).await.unwrap(),
176+
vec![
177+
"content/".to_string(),
178+
"content/first".to_string(),
179+
"content/third".to_string(),
180+
"content/nested/".to_string(),
181+
"content/nested/second".to_string(),
182+
],
183+
"file list inside the archive did not match"
184+
);
185+
}
186+
187+
#[tokio::test]
188+
#[cfg(feature = "tokio_support")]
189+
async fn list_archive_zip_tokio() {
190+
let source = tokio::fs::File::open("tests/fixtures/test.zip")
191+
.await
192+
.unwrap();
193+
194+
assert_eq!(
195+
tokio_support::list_archive_files(source).await.unwrap(),
196+
vec![
197+
"content/".to_string(),
198+
"content/first".to_string(),
199+
"content/third".to_string(),
200+
"content/nested/".to_string(),
201+
"content/nested/second".to_string(),
202+
],
203+
"file list inside the archive did not match"
204+
);
205+
}
206+
150207
#[async_std::test]
151208
#[cfg(feature = "futures_support")]
152209
async fn successfully_list_archive_files_futures() {

0 commit comments

Comments
 (0)