mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2025-01-06 01:08:46 +00:00
ID3v2: Add test for #204
A UFID frame without an owner is invalid, and will fail in `ParsingMode::Strict`. In `ParsingMode::BestAttempt`, however, we will just replace it with an empty string.
This commit is contained in:
parent
ed68ca8851
commit
e54a6135f9
1 changed files with 21 additions and 0 deletions
|
@ -68,3 +68,24 @@ impl Hash for UniqueFileIdentifierFrame {
|
||||||
self.owner.hash(state);
|
self.owner.hash(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn issue_204_invalid_ufid_parsing_mode_best_attempt() {
|
||||||
|
use crate::id3::v2::UniqueFileIdentifierFrame;
|
||||||
|
use crate::ParsingMode;
|
||||||
|
|
||||||
|
let ufid_no_owner = UniqueFileIdentifierFrame {
|
||||||
|
owner: String::new(),
|
||||||
|
identifier: vec![0],
|
||||||
|
};
|
||||||
|
|
||||||
|
let bytes = ufid_no_owner.as_bytes();
|
||||||
|
|
||||||
|
assert!(UniqueFileIdentifierFrame::parse(&mut &bytes[..], ParsingMode::Strict).is_err());
|
||||||
|
assert!(
|
||||||
|
UniqueFileIdentifierFrame::parse(&mut &bytes[..], ParsingMode::BestAttempt).is_ok()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue