From 0d01598035d0e5ca6a336ff4bf23722b84e9aa05 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 3 Jan 2023 11:58:37 -0300 Subject: [PATCH] tests: add integration test using a Zip file to trigger Seek Signed-off-by: Otavio Salvador --- tests/fixtures/test.zip | Bin 0 -> 960 bytes tests/integration_test.rs | 57 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/fixtures/test.zip diff --git a/tests/fixtures/test.zip b/tests/fixtures/test.zip new file mode 100644 index 0000000000000000000000000000000000000000..6c3b2203cb9496006133d2c87e258479f4b4124e GIT binary patch literal 960 zcmWIWW@Zs#0D&DMN?~9Il;B{{WJu1>D@n~O(GLybWMDnhxhWZhODnh;7+FB7z(hq3 zCj+|(Gl>7zF#v2F2LlJgIwa%RfO5P@#-(Kz6_q|y7dj+Wj-CWZiS zb`Gu0UdK6rrh!aE*oEwLbh}D2GK*4(bpMh@?UN^Tyr6b{ny6EOY8TK_hAl|`0`d8g z{FRqlT#}js39TbQUx6@gpCN}9vZ?GqQ$;aNElvf-2E-?X%?A3!&-dJUZ>U%54)C*a z0*wV39pKH#B*Kg<&SiiqAmFVdh$bclz)XZiJ8~rPG9XM`(&&$5BEdv}Y%C~-k>dl^ z*xg9R5{z${u^`_e2Rn$*kL237j_QmE{}U0lFoQwC05TXk&_$69UeZ{LX)xi~4e(|K SrELaQAlv~o;1dutFaQ8{MY>P` literal 0 HcmV?d00001 diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 431e26b..094f51c 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -147,6 +147,63 @@ fn successfully_list_archive_files() { ); } +#[test] +fn list_archive_zip() { + let source = std::fs::File::open("tests/fixtures/test.zip").unwrap(); + + assert_eq!( + list_archive_files(source).unwrap(), + vec![ + "content/".to_string(), + "content/first".to_string(), + "content/third".to_string(), + "content/nested/".to_string(), + "content/nested/second".to_string(), + ], + "file list inside the archive did not match" + ); +} + +#[async_std::test] +#[cfg(feature = "futures_support")] +async fn list_archive_zip_futures() { + let source = async_std::fs::File::open("tests/fixtures/test.zip") + .await + .unwrap(); + + assert_eq!( + futures_support::list_archive_files(source).await.unwrap(), + vec![ + "content/".to_string(), + "content/first".to_string(), + "content/third".to_string(), + "content/nested/".to_string(), + "content/nested/second".to_string(), + ], + "file list inside the archive did not match" + ); +} + +#[tokio::test] +#[cfg(feature = "tokio_support")] +async fn list_archive_zip_tokio() { + let source = tokio::fs::File::open("tests/fixtures/test.zip") + .await + .unwrap(); + + assert_eq!( + tokio_support::list_archive_files(source).await.unwrap(), + vec![ + "content/".to_string(), + "content/first".to_string(), + "content/third".to_string(), + "content/nested/".to_string(), + "content/nested/second".to_string(), + ], + "file list inside the archive did not match" + ); +} + #[async_std::test] #[cfg(feature = "futures_support")] async fn successfully_list_archive_files_futures() {