mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-12 21:52:33 +00:00
Vorbis Comments: Add zero-sized test
This commit is contained in:
parent
2f62ff9b60
commit
d298199a07
3 changed files with 11 additions and 9 deletions
|
@ -549,8 +549,6 @@ mod tests {
|
|||
use crate::ogg::VorbisComments;
|
||||
use crate::{Tag, TagExt, TagType};
|
||||
|
||||
use std::io::Read;
|
||||
|
||||
fn read_tag(tag: &[u8]) -> VorbisComments {
|
||||
let mut reader = std::io::Cursor::new(tag);
|
||||
let mut parsed_tag = VorbisComments::default();
|
||||
|
@ -597,11 +595,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn vorbis_comments_to_tag() {
|
||||
let mut tag_bytes = Vec::new();
|
||||
std::fs::File::open("tests/tags/assets/test.vorbis")
|
||||
.unwrap()
|
||||
.read_to_end(&mut tag_bytes)
|
||||
.unwrap();
|
||||
let tag_bytes = std::fs::read("tests/tags/assets/test.vorbis").unwrap();
|
||||
|
||||
let mut reader = std::io::Cursor::new(&tag_bytes[..]);
|
||||
let mut vorbis_comments = VorbisComments::default();
|
||||
|
@ -626,4 +620,14 @@ mod tests {
|
|||
assert_eq!(vorbis_comments.get("TRACKNUMBER"), Some("1"));
|
||||
assert_eq!(vorbis_comments.get("GENRE"), Some("Classical"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zero_sized_vorbis_comments() {
|
||||
let tag_bytes = std::fs::read("tests/tags/assets/zero.vorbis").unwrap();
|
||||
|
||||
let mut reader = std::io::Cursor::new(&tag_bytes[..]);
|
||||
let mut vorbis_comments = VorbisComments::default();
|
||||
|
||||
crate::ogg::read::read_comments(&mut reader, &mut vorbis_comments).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@ use lofty::mp3::Mp3File;
|
|||
use lofty::mp4::Mp4File;
|
||||
use lofty::AudioFile;
|
||||
|
||||
// TODO: zero-size vorbis comments
|
||||
|
||||
fn read_file_with_properties<A: AudioFile>(path: &str) -> bool {
|
||||
let res = <A as AudioFile>::read_from(&mut std::fs::File::open(path).unwrap(), true);
|
||||
res.is_ok()
|
||||
|
|
BIN
tests/tags/assets/zero.vorbis
Normal file
BIN
tests/tags/assets/zero.vorbis
Normal file
Binary file not shown.
Loading…
Reference in a new issue