test: skip deflate64 in compression tests

This commit is contained in:
anatawa12 2023-08-04 23:14:23 +09:00
parent 70c0b164be
commit c82edf6ed2
No known key found for this signature in database
GPG key ID: 9CA909848B8E4EA6
5 changed files with 36 additions and 0 deletions

6
tests/data/README.md Normal file
View file

@ -0,0 +1,6 @@
A few assets in directory is copied from [dotnet-assets].
- [`deflate64.zip`](./deflate64.zip) is originally at https://github.com/dotnet/runtime-assets/blob/95277f38e68b66f1b48600d90d456c32c9ae0fa2/src/System.IO.Compression.TestData/ZipTestData/compat/deflate64.zip
- [`folder/binary.wmv`](./folder/binary.wmv) is originally at https://github.com/dotnet/runtime-assets/tree/95277f38e68b66f1b48600d90d456c32c9ae0fa2/src/System.IO.Compression.TestData/ZipTestData/refzipfolders/normal/binary.wmv
[dotnet-assets]: https://github.com/dotnet/runtime-assets

BIN
tests/data/deflate64.zip Normal file

Binary file not shown.

Binary file not shown.

21
tests/deflate64.rs Normal file
View file

@ -0,0 +1,21 @@
#![cfg(feature = "deflate64")]
use std::io::{self, Read};
use zip::ZipArchive;
#[test]
fn decompress_deflate64() {
let mut v = Vec::new();
v.extend_from_slice(include_bytes!("data/deflate64.zip"));
let mut archive = ZipArchive::new(io::Cursor::new(v)).expect("couldn't open test zip file");
let mut file = archive
.by_name("binary.wmv")
.expect("couldn't find file in archive");
assert_eq!("binary.wmv", file.name());
let mut content = Vec::new();
file.read_to_end(&mut content)
.expect("couldn't read encrypted and compressed file");
assert_eq!(include_bytes!("data/folder/binary.wmv"), &content[..]);
}

View file

@ -11,6 +11,9 @@ use zip::{CompressionMethod, SUPPORTED_COMPRESSION_METHODS};
#[test]
fn end_to_end() {
for &method in SUPPORTED_COMPRESSION_METHODS {
if method == CompressionMethod::DEFLATE64 {
continue
}
let file = &mut Cursor::new(Vec::new());
println!("Writing file with {method} compression");
@ -26,6 +29,9 @@ fn end_to_end() {
#[test]
fn copy() {
for &method in SUPPORTED_COMPRESSION_METHODS {
if method == CompressionMethod::DEFLATE64 {
continue
}
let src_file = &mut Cursor::new(Vec::new());
write_test_archive(src_file, method).expect("Couldn't write to test file");
@ -65,6 +71,9 @@ fn copy() {
#[test]
fn append() {
for &method in SUPPORTED_COMPRESSION_METHODS {
if method == CompressionMethod::DEFLATE64 {
continue
}
let mut file = &mut Cursor::new(Vec::new());
write_test_archive(file, method).expect("Couldn't write to test file");