#![cfg(any(feature = "lz4", feature = "brotli"))]
use std::path::PathBuf;
use zesven::read::{Archive, SelectAll, TestOptions};
fn fixtures_path() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures")
}
#[test]
#[cfg(feature = "lz4")]
fn decompress_lz4_with_skippable_frames() {
let path = fixtures_path().join("zstdmt-lz4.7z");
let mut archive = Archive::open_path(&path).expect("Failed to open archive");
let result = archive
.test(SelectAll, &TestOptions::default())
.expect("Failed to test archive");
assert!(
result.failures.is_empty(),
"LZ4 with skippable frames should decompress successfully: {:?}",
result.failures
);
}
#[test]
#[cfg(feature = "brotli")]
fn decompress_brotli_with_skippable_frames() {
let path = fixtures_path().join("zstdmt-brotli.7z");
let mut archive = Archive::open_path(&path).expect("Failed to open archive");
let result = archive
.test(SelectAll, &TestOptions::default())
.expect("Failed to test archive");
assert!(
result.failures.is_empty(),
"Brotli with skippable frames should decompress successfully: {:?}",
result.failures
);
}
#[test]
#[cfg(feature = "lz4")]
fn extract_lz4_with_skippable_frames() {
let path = fixtures_path().join("zstdmt-lz4.7z");
let mut archive = Archive::open_path(&path).expect("Failed to open archive");
let content = archive
.extract_to_vec("LICENSE")
.expect("Failed to extract LICENSE");
let text = String::from_utf8_lossy(&content);
assert!(
text.contains("Apache License"),
"LICENSE should contain 'Apache License', got: {}...",
&text[..text.len().min(100)]
);
}
#[test]
#[cfg(feature = "brotli")]
fn extract_brotli_with_skippable_frames() {
let path = fixtures_path().join("zstdmt-brotli.7z");
let mut archive = Archive::open_path(&path).expect("Failed to open archive");
let content = archive
.extract_to_vec("LICENSE")
.expect("Failed to extract LICENSE");
let text = String::from_utf8_lossy(&content);
assert!(
text.contains("Apache License"),
"LICENSE should contain 'Apache License', got: {}...",
&text[..text.len().min(100)]
);
}