mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-15 06:52:23 +00:00
Use neutral errors in shared XFL reader
This commit is contained in:
1 parent
b4d1e249d9
commit
389aef0fda
2 files changed
+7
-2
No files matched your search
@@ -39,9 +39,9 @@ pub enum ZipError {
|
||||
Damaged(&'static str),
|
||||
#[error("the archive is damaged: '{0}' {1}")]
|
||||
DamagedEntry(String, &'static str),
|
||||
#[error("the archive uses a zip feature AniCraft can't read ({0})")]
|
||||
#[error("the archive uses a zip feature this XFL reader can't read ({0})")]
|
||||
UnsupportedArchive(&'static str),
|
||||
#[error("'{0}' uses a zip feature AniCraft can't read ({1})")]
|
||||
#[error("'{0}' uses a zip feature this XFL reader can't read ({1})")]
|
||||
Unsupported(String, &'static str),
|
||||
#[error("'{0}' is too large to read")]
|
||||
TooLarge(String),
|
||||
|
||||
@@ -232,6 +232,11 @@ fn deeply_nested_folders_are_refused() {
|
||||
|
||||
#[test]
|
||||
fn unsupported_features_say_what_they_are() {
|
||||
assert_eq!(ZipError::UnsupportedArchive("split across several files").to_string(), "the archive uses a zip feature this XFL reader can't read (split across several files)");
|
||||
assert_eq!(
|
||||
ZipError::Unsupported("a.xml".into(), "encryption").to_string(),
|
||||
"'a.xml' uses a zip feature this XFL reader can't read (encryption)"
|
||||
);
|
||||
let mut r = Raw::new("a.xml", b"secret", false);
|
||||
r.flags = 1;
|
||||
assert_eq!(error(&write(&[r], false)), ZipError::Unsupported("a.xml".into(), "encryption"));
|
||||
|
||||
Reference in new issue
Block a user