Tests: Switch to test_log

We have really good debug/trace logs now. Having them available for test failures is a huge help.
This commit is contained in:
Serial 2024-08-31 13:38:30 -04:00 committed by Alex
parent e54a0abd00
commit 069b7bfc97
62 changed files with 414 additions and 407 deletions

View file

@ -36,6 +36,7 @@ hound = { git = "https://github.com/ruuda/hound.git", rev = "02e66effb33683d
# tag_writer example
structopt = { version = "0.3.26", default-features = false }
tempfile = "3.10.1"
test-log = "0.2.16"
iai-callgrind = "0.12.0"
[lints]

View file

@ -572,7 +572,7 @@ mod tests {
use crate::picture::{MimeType, Picture, PictureType};
use std::io::Cursor;
#[test]
#[test_log::test]
fn parse_ape() {
let mut expected_tag = ApeTag::default();
@ -636,7 +636,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn ape_re_read() {
let tag_bytes = crate::tag::utils::test_utils::read_path("tests/tags/assets/test.apev2");
let mut reader = Cursor::new(tag_bytes);
@ -664,7 +664,7 @@ mod tests {
assert_eq!(parsed_tag, temp_parsed_tag);
}
#[test]
#[test_log::test]
fn ape_to_tag() {
let tag_bytes = crate::tag::utils::test_utils::read_path("tests/tags/assets/test.apev2");
let mut reader = Cursor::new(tag_bytes);
@ -680,7 +680,7 @@ mod tests {
crate::tag::utils::test_utils::verify_tag(&tag, true, true);
}
#[test]
#[test_log::test]
fn tag_to_ape() {
fn verify_key(tag: &ApeTag, key: &str, expected_val: &str) {
assert_eq!(
@ -701,7 +701,7 @@ mod tests {
verify_key(&ape_tag, "Genre", "Classical");
}
#[test]
#[test_log::test]
fn set_track() {
let mut ape = ApeTag::default();
let track = 1;
@ -712,7 +712,7 @@ mod tests {
assert!(ape.track_total().is_none());
}
#[test]
#[test_log::test]
fn set_track_total() {
let mut ape = ApeTag::default();
let track_total = 2;
@ -723,7 +723,7 @@ mod tests {
assert_eq!(ape.track_total().unwrap(), track_total);
}
#[test]
#[test_log::test]
fn set_track_and_track_total() {
let mut ape = ApeTag::default();
let track = 1;
@ -736,7 +736,7 @@ mod tests {
assert_eq!(ape.track_total().unwrap(), track_total);
}
#[test]
#[test_log::test]
fn set_track_total_and_track() {
let mut ape = ApeTag::default();
let track_total = 2;
@ -749,7 +749,7 @@ mod tests {
assert_eq!(ape.track().unwrap(), track);
}
#[test]
#[test_log::test]
fn set_disk() {
let mut ape = ApeTag::default();
let disk = 1;
@ -760,7 +760,7 @@ mod tests {
assert!(ape.disk_total().is_none());
}
#[test]
#[test_log::test]
fn set_disk_total() {
let mut ape = ApeTag::default();
let disk_total = 2;
@ -771,7 +771,7 @@ mod tests {
assert_eq!(ape.disk_total().unwrap(), disk_total);
}
#[test]
#[test_log::test]
fn set_disk_and_disk_total() {
let mut ape = ApeTag::default();
let disk = 1;
@ -784,7 +784,7 @@ mod tests {
assert_eq!(ape.disk_total().unwrap(), disk_total);
}
#[test]
#[test_log::test]
fn set_disk_total_and_disk() {
let mut ape = ApeTag::default();
let disk_total = 2;
@ -797,7 +797,7 @@ mod tests {
assert_eq!(ape.disk().unwrap(), disk);
}
#[test]
#[test_log::test]
fn track_number_tag_to_ape() {
let track_number = 1;
@ -814,7 +814,7 @@ mod tests {
assert!(tag.track_total().is_none());
}
#[test]
#[test_log::test]
fn track_total_tag_to_ape() {
let track_total = 2;
@ -831,7 +831,7 @@ mod tests {
assert_eq!(tag.track_total().unwrap(), track_total);
}
#[test]
#[test_log::test]
fn track_number_and_track_total_tag_to_ape() {
let track_number = 1;
let track_total = 2;
@ -854,7 +854,7 @@ mod tests {
assert_eq!(tag.track_total().unwrap(), track_total);
}
#[test]
#[test_log::test]
fn disk_number_tag_to_ape() {
let disk_number = 1;
@ -871,7 +871,7 @@ mod tests {
assert!(tag.disk_total().is_none());
}
#[test]
#[test_log::test]
fn disk_total_tag_to_ape() {
let disk_total = 2;
@ -888,7 +888,7 @@ mod tests {
assert_eq!(tag.disk_total().unwrap(), disk_total);
}
#[test]
#[test_log::test]
fn disk_number_and_disk_total_tag_to_ape() {
let disk_number = 1;
let disk_total = 2;
@ -911,7 +911,7 @@ mod tests {
assert_eq!(tag.disk_total().unwrap(), disk_total);
}
#[test]
#[test_log::test]
fn skip_reading_cover_art() {
let p = Picture::new_unchecked(
PictureType::CoverFront,

View file

@ -463,7 +463,7 @@ mod tests {
use crate::prelude::*;
use crate::tag::{Tag, TagType};
#[test]
#[test_log::test]
fn parse_id3v1() {
let expected_tag = Id3v1Tag {
title: Some(String::from("Foo title")),
@ -481,7 +481,7 @@ mod tests {
assert_eq!(expected_tag, parsed_tag);
}
#[test]
#[test_log::test]
fn id3v2_re_read() {
let tag = crate::tag::utils::test_utils::read_path("tests/tags/assets/test.id3v1");
let parsed_tag = crate::id3::v1::read::parse_id3v1(tag.try_into().unwrap());
@ -496,7 +496,7 @@ mod tests {
assert_eq!(parsed_tag, temp_parsed_tag);
}
#[test]
#[test_log::test]
fn id3v1_to_tag() {
let tag_bytes = crate::tag::utils::test_utils::read_path("tests/tags/assets/test.id3v1");
let id3v1 = crate::id3::v1::read::parse_id3v1(tag_bytes.try_into().unwrap());
@ -506,7 +506,7 @@ mod tests {
crate::tag::utils::test_utils::verify_tag(&tag, true, true);
}
#[test]
#[test_log::test]
fn tag_to_id3v1() {
let tag = crate::tag::utils::test_utils::create_tag(TagType::Id3v1);

View file

@ -250,7 +250,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn atxt_decode() {
let expected = expected();
@ -261,7 +261,7 @@ mod tests {
assert_eq!(parsed_atxt, expected);
}
#[test]
#[test_log::test]
fn atxt_encode() {
let to_encode = expected();

View file

@ -144,7 +144,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn geob_decode() {
let expected = expected();
@ -155,7 +155,7 @@ mod tests {
assert_eq!(parsed_geob, expected);
}
#[test]
#[test_log::test]
fn geob_encode() {
let to_encode = expected();

View file

@ -307,7 +307,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn etco_decode() {
let cont = crate::tag::utils::test_utils::read_path("tests/tags/assets/id3v2/test.etco");
@ -318,7 +318,7 @@ mod tests {
assert_eq!(parsed_etco, expected());
}
#[test]
#[test_log::test]
fn etco_encode() {
let encoded = expected().as_bytes();

View file

@ -153,7 +153,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn owne_decode() {
let cont = crate::tag::utils::test_utils::read_path("tests/tags/assets/id3v2/test.owne");
@ -164,7 +164,7 @@ mod tests {
assert_eq!(parsed_owne, expected());
}
#[test]
#[test_log::test]
fn owne_encode() {
let encoded = expected().as_bytes(false).unwrap();

View file

@ -167,7 +167,7 @@ mod tests {
assert_eq!(popm_bytes[email.len() + 2..].len(), counter_len);
}
#[test]
#[test_log::test]
fn write_popm() {
let popm_u32_boundary = PopularimeterFrame {
header: FrameHeader::new(super::FRAME_ID, FrameFlags::default()),

View file

@ -113,7 +113,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn priv_decode() {
let cont = crate::tag::utils::test_utils::read_path("tests/tags/assets/id3v2/test.priv");
@ -124,7 +124,7 @@ mod tests {
assert_eq!(parsed_priv, expected());
}
#[test]
#[test_log::test]
fn priv_encode() {
let encoded = expected().as_bytes().unwrap();

View file

@ -286,7 +286,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn rva2_decode() {
let cont = crate::tag::utils::test_utils::read_path("tests/tags/assets/id3v2/test.rva2");
@ -301,7 +301,7 @@ mod tests {
assert_eq!(parsed_rva2, expected());
}
#[test]
#[test_log::test]
#[allow(unstable_name_collisions)]
fn rva2_encode() {
let encoded = expected().as_bytes();

View file

@ -286,7 +286,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn sylt_decode() {
let cont = crate::tag::utils::test_utils::read_path("tests/tags/assets/id3v2/test.sylt");
@ -295,7 +295,7 @@ mod tests {
assert_eq!(parsed_sylt, expected(TextEncoding::Latin1));
}
#[test]
#[test_log::test]
fn sylt_encode() {
let encoded = expected(TextEncoding::Latin1).as_bytes().unwrap();
@ -305,7 +305,7 @@ mod tests {
assert_eq!(encoded, expected_bytes);
}
#[test]
#[test_log::test]
fn sylt_decode_utf16() {
let cont =
crate::tag::utils::test_utils::read_path("tests/tags/assets/id3v2/test_utf16.sylt");
@ -315,7 +315,7 @@ mod tests {
assert_eq!(parsed_sylt, expected(TextEncoding::UTF16));
}
#[test]
#[test_log::test]
fn sylt_encode_utf_16() {
let encoded = expected(TextEncoding::UTF16).as_bytes().unwrap();

View file

@ -121,7 +121,7 @@ mod tests {
use std::borrow::Cow;
#[test]
#[test_log::test]
fn issue_204_invalid_ufid_parsing_mode_best_attempt() {
use crate::config::ParsingMode;
use crate::id3::v2::UniqueFileIdentifierFrame;

View file

@ -192,53 +192,59 @@ where
Ok(tag)
}
#[test]
fn zero_size_id3v2() {
use crate::config::ParsingMode;
use crate::id3::v2::header::Id3v2Header;
#[cfg(test)]
mod tests {
use super::parse_id3v2;
use crate::config::ParseOptions;
use std::io::Cursor;
#[test_log::test]
fn zero_size_id3v2() {
use crate::config::ParsingMode;
use crate::id3::v2::header::Id3v2Header;
let mut f = Cursor::new(std::fs::read("tests/tags/assets/id3v2/zero.id3v2").unwrap());
let header = Id3v2Header::parse(&mut f).unwrap();
assert!(parse_id3v2(
&mut f,
header,
ParseOptions::new().parsing_mode(ParsingMode::Strict)
)
.is_ok());
}
#[test]
fn bad_frame_id_relaxed_id3v2() {
use crate::config::ParsingMode;
use crate::id3::v2::header::Id3v2Header;
use crate::prelude::*;
use std::io::Cursor;
// Contains a frame with a "+" in the ID, which is invalid.
// All other frames in the tag are valid, however.
let mut f = Cursor::new(
std::fs::read("tests/tags/assets/id3v2/bad_frame_otherwise_valid.id3v24").unwrap(),
);
let header = Id3v2Header::parse(&mut f).unwrap();
let id3v2 = parse_id3v2(
&mut f,
header,
ParseOptions::new().parsing_mode(ParsingMode::Relaxed),
);
assert!(id3v2.is_ok());
let id3v2 = id3v2.unwrap();
// There are 6 valid frames and 1 invalid frame
assert_eq!(id3v2.len(), 6);
assert_eq!(id3v2.title().as_deref(), Some("Foo title"));
assert_eq!(id3v2.artist().as_deref(), Some("Bar artist"));
assert_eq!(id3v2.comment().as_deref(), Some("Qux comment"));
assert_eq!(id3v2.year(), Some(1984));
assert_eq!(id3v2.track(), Some(1));
assert_eq!(id3v2.genre().as_deref(), Some("Classical"));
use std::io::Cursor;
let mut f = Cursor::new(std::fs::read("tests/tags/assets/id3v2/zero.id3v2").unwrap());
let header = Id3v2Header::parse(&mut f).unwrap();
assert!(parse_id3v2(
&mut f,
header,
ParseOptions::new().parsing_mode(ParsingMode::Strict)
)
.is_ok());
}
#[test_log::test]
fn bad_frame_id_relaxed_id3v2() {
use crate::config::ParsingMode;
use crate::id3::v2::header::Id3v2Header;
use crate::prelude::*;
use std::io::Cursor;
// Contains a frame with a "+" in the ID, which is invalid.
// All other frames in the tag are valid, however.
let mut f = Cursor::new(
std::fs::read("tests/tags/assets/id3v2/bad_frame_otherwise_valid.id3v24").unwrap(),
);
let header = Id3v2Header::parse(&mut f).unwrap();
let id3v2 = parse_id3v2(
&mut f,
header,
ParseOptions::new().parsing_mode(ParsingMode::Relaxed),
);
assert!(id3v2.is_ok());
let id3v2 = id3v2.unwrap();
// There are 6 valid frames and 1 invalid frame
assert_eq!(id3v2.len(), 6);
assert_eq!(id3v2.title().as_deref(), Some("Foo title"));
assert_eq!(id3v2.artist().as_deref(), Some("Bar artist"));
assert_eq!(id3v2.comment().as_deref(), Some("Qux comment"));
assert_eq!(id3v2.year(), Some(1984));
assert_eq!(id3v2.track(), Some(1));
assert_eq!(id3v2.genre().as_deref(), Some("Classical"));
}
}

View file

@ -41,7 +41,7 @@ fn dump_and_re_read(tag: &Id3v2Tag, write_options: WriteOptions) -> Id3v2Tag {
)
}
#[test]
#[test_log::test]
fn parse_id3v2() {
let mut expected_tag = Id3v2Tag::default();
@ -98,7 +98,7 @@ fn parse_id3v2() {
assert_eq!(expected_tag, parsed_tag);
}
#[test]
#[test_log::test]
fn id3v2_re_read() {
let parsed_tag = read_tag("tests/tags/assets/id3v2/test.id3v24");
@ -120,7 +120,7 @@ fn id3v2_re_read() {
assert_eq!(parsed_tag, temp_parsed_tag);
}
#[test]
#[test_log::test]
fn id3v2_to_tag() {
let id3v2 = read_tag("tests/tags/assets/id3v2/test.id3v24");
@ -129,7 +129,7 @@ fn id3v2_to_tag() {
crate::tag::utils::test_utils::verify_tag(&tag, true, true);
}
#[test]
#[test_log::test]
fn fail_write_bad_frame() {
let mut tag = Id3v2Tag::default();
@ -147,7 +147,7 @@ fn fail_write_bad_frame() {
);
}
#[test]
#[test_log::test]
fn tag_to_id3v2() {
fn verify_frame(tag: &Id3v2Tag, id: &str, value: &str) {
let frame = tag.get(&FrameId::Valid(Cow::Borrowed(id)));
@ -256,7 +256,7 @@ fn create_full_test_tag(version: Id3v2Version) -> Id3v2Tag {
tag
}
#[test]
#[test_log::test]
fn id3v24_full() {
let tag = create_full_test_tag(Id3v2Version::V4);
let parsed_tag = read_tag("tests/tags/assets/id3v2/test_full.id3v24");
@ -264,7 +264,7 @@ fn id3v24_full() {
assert_eq!(tag, parsed_tag);
}
#[test]
#[test_log::test]
fn id3v23_full() {
let mut tag = create_full_test_tag(Id3v2Version::V3);
let mut parsed_tag = read_tag("tests/tags/assets/id3v2/test_full.id3v23");
@ -277,7 +277,7 @@ fn id3v23_full() {
assert_eq!(tag, parsed_tag);
}
#[test]
#[test_log::test]
fn id3v22_full() {
let tag = create_full_test_tag(Id3v2Version::V2);
let parsed_tag = read_tag("tests/tags/assets/id3v2/test_full.id3v22");
@ -285,7 +285,7 @@ fn id3v22_full() {
assert_eq!(tag, parsed_tag);
}
#[test]
#[test_log::test]
fn id3v24_footer() {
let mut tag = create_full_test_tag(Id3v2Version::V4);
tag.flags.footer = true;
@ -306,7 +306,7 @@ fn id3v24_footer() {
assert_eq!(writer[3..10], writer[writer.len() - 7..])
}
#[test]
#[test_log::test]
fn issue_36() {
let picture_data = vec![0; 200];
@ -343,7 +343,7 @@ fn issue_36() {
);
}
#[test]
#[test_log::test]
fn popm_frame() {
let parsed_tag = read_tag("tests/tags/assets/id3v2/test_popm.id3v24");
@ -361,7 +361,7 @@ fn popm_frame() {
)
}
#[test]
#[test_log::test]
fn multi_value_frame_to_tag() {
let mut tag = Id3v2Tag::default();
@ -372,7 +372,7 @@ fn multi_value_frame_to_tag() {
assert_eq!(&collected_artists, &["foo", "bar", "baz"])
}
#[test]
#[test_log::test]
fn multi_item_tag_to_id3v2() {
let mut tag = Tag::new(TagType::Id3v2);
@ -393,12 +393,12 @@ fn multi_item_tag_to_id3v2() {
assert_eq!(tag.artist().as_deref(), Some("foo/bar/baz"))
}
#[test]
#[test_log::test]
fn utf16_txxx_with_single_bom() {
let _ = read_tag("tests/tags/assets/id3v2/issue_53.id3v24");
}
#[test]
#[test_log::test]
fn replaygain_tag_conversion() {
let mut tag = Id3v2Tag::default();
tag.insert(Frame::UserText(ExtendedTextFrame::new(
@ -419,7 +419,7 @@ fn replaygain_tag_conversion() {
);
}
#[test]
#[test_log::test]
fn multi_value_roundtrip() {
let mut tag = Tag::new(TagType::Id3v2);
// 1st: Multi-valued text frames
@ -486,7 +486,7 @@ fn multi_value_roundtrip() {
assert_eq!(tag.items, split_tag.items);
}
#[test]
#[test_log::test]
fn comments() {
let mut tag = Id3v2Tag::default();
let encoding = TextEncoding::Latin1;
@ -525,7 +525,7 @@ fn comments() {
.is_some());
}
#[test]
#[test_log::test]
fn txxx_wxxx_tag_conversion() {
let txxx_frame = Frame::UserText(ExtendedTextFrame::new(
TextEncoding::UTF8,
@ -568,7 +568,7 @@ fn txxx_wxxx_tag_conversion() {
assert_eq!(&tag.frames, &[txxx_frame, wxxx_frame])
}
#[test]
#[test_log::test]
fn user_defined_frames_conversion() {
let mut id3v2 = Id3v2Tag::default();
id3v2.insert(Frame::UserText(ExtendedTextFrame::new(
@ -616,7 +616,7 @@ fn user_defined_frames_conversion() {
assert_eq!(id3v2, reparsed);
}
#[test]
#[test_log::test]
fn set_track() {
let mut id3v2 = Id3v2Tag::default();
let track = 1;
@ -627,7 +627,7 @@ fn set_track() {
assert!(id3v2.track_total().is_none());
}
#[test]
#[test_log::test]
fn set_track_total() {
let mut id3v2 = Id3v2Tag::default();
let track_total = 2;
@ -638,7 +638,7 @@ fn set_track_total() {
assert_eq!(id3v2.track_total().unwrap(), track_total);
}
#[test]
#[test_log::test]
fn set_track_and_track_total() {
let mut id3v2 = Id3v2Tag::default();
let track = 1;
@ -651,7 +651,7 @@ fn set_track_and_track_total() {
assert_eq!(id3v2.track_total().unwrap(), track_total);
}
#[test]
#[test_log::test]
fn set_track_total_and_track() {
let mut id3v2 = Id3v2Tag::default();
let track_total = 2;
@ -664,7 +664,7 @@ fn set_track_total_and_track() {
assert_eq!(id3v2.track().unwrap(), track);
}
#[test]
#[test_log::test]
fn set_disk() {
let mut id3v2 = Id3v2Tag::default();
let disk = 1;
@ -675,7 +675,7 @@ fn set_disk() {
assert!(id3v2.disk_total().is_none());
}
#[test]
#[test_log::test]
fn set_disk_total() {
let mut id3v2 = Id3v2Tag::default();
let disk_total = 2;
@ -686,7 +686,7 @@ fn set_disk_total() {
assert_eq!(id3v2.disk_total().unwrap(), disk_total);
}
#[test]
#[test_log::test]
fn set_disk_and_disk_total() {
let mut id3v2 = Id3v2Tag::default();
let disk = 1;
@ -699,7 +699,7 @@ fn set_disk_and_disk_total() {
assert_eq!(id3v2.disk_total().unwrap(), disk_total);
}
#[test]
#[test_log::test]
fn set_disk_total_and_disk() {
let mut id3v2 = Id3v2Tag::default();
let disk_total = 2;
@ -712,7 +712,7 @@ fn set_disk_total_and_disk() {
assert_eq!(id3v2.disk().unwrap(), disk);
}
#[test]
#[test_log::test]
fn track_number_tag_to_id3v2() {
let track_number = 1;
@ -729,7 +729,7 @@ fn track_number_tag_to_id3v2() {
assert!(tag.track_total().is_none());
}
#[test]
#[test_log::test]
fn track_total_tag_to_id3v2() {
let track_total = 2;
@ -746,7 +746,7 @@ fn track_total_tag_to_id3v2() {
assert_eq!(tag.track_total().unwrap(), track_total);
}
#[test]
#[test_log::test]
fn track_number_and_track_total_tag_to_id3v2() {
let track_number = 1;
let track_total = 2;
@ -769,7 +769,7 @@ fn track_number_and_track_total_tag_to_id3v2() {
assert_eq!(tag.track_total().unwrap(), track_total);
}
#[test]
#[test_log::test]
fn disk_number_tag_to_id3v2() {
let disk_number = 1;
@ -786,7 +786,7 @@ fn disk_number_tag_to_id3v2() {
assert!(tag.disk_total().is_none());
}
#[test]
#[test_log::test]
fn disk_total_tag_to_id3v2() {
let disk_total = 2;
@ -803,7 +803,7 @@ fn disk_total_tag_to_id3v2() {
assert_eq!(tag.disk_total().unwrap(), disk_total);
}
#[test]
#[test_log::test]
fn disk_number_and_disk_total_tag_to_id3v2() {
let disk_number = 1;
let disk_total = 2;
@ -842,7 +842,7 @@ fn create_tag_with_trck_and_tpos_frame(content: &'static str) -> Tag {
tag.into()
}
#[test]
#[test_log::test]
fn valid_trck_and_tpos_frame() {
fn assert_valid(content: &'static str, number: Option<u32>, total: Option<u32>) {
let tag = create_tag_with_trck_and_tpos_frame(content);
@ -862,7 +862,7 @@ fn valid_trck_and_tpos_frame() {
assert_valid("1 / 2", Some(1), Some(2));
}
#[test]
#[test_log::test]
fn invalid_trck_and_tpos_frame() {
fn assert_invalid(content: &'static str) {
let tag = create_tag_with_trck_and_tpos_frame(content);
@ -884,7 +884,7 @@ fn invalid_trck_and_tpos_frame() {
assert_invalid("0x1/0x2");
}
#[test]
#[test_log::test]
fn ufid_frame_with_musicbrainz_record_id() {
let mut id3v2 = Id3v2Tag::default();
let unknown_ufid_frame =
@ -936,7 +936,7 @@ fn ufid_frame_with_musicbrainz_record_id() {
}
}
#[test]
#[test_log::test]
fn get_set_user_defined_text() {
let description = String::from("FOO_BAR");
let content = String::from("Baz!\0Qux!");
@ -988,7 +988,7 @@ fn get_set_user_defined_text() {
assert!(id3v2.is_empty());
}
#[test]
#[test_log::test]
fn read_multiple_composers_should_not_fail_with_bad_frame_length() {
// Issue #255
let tag = read_tag("tests/tags/assets/id3v2/multiple_composers.id3v24");
@ -1001,7 +1001,7 @@ fn read_multiple_composers_should_not_fail_with_bad_frame_length() {
assert_eq!(composers.next(), None)
}
#[test]
#[test_log::test]
fn trim_end_nulls_when_reading_frame_content() {
// Issue #273
// Tag written by mid3v2. All frames contain null-terminated UTF-8 text
@ -1034,24 +1034,24 @@ fn id3v2_tag_with_genre(value: &str) -> Id3v2Tag {
tag
}
#[test]
#[test_log::test]
fn genre_text() {
let tag = id3v2_tag_with_genre("Dream Pop");
assert_eq!(tag.genre(), Some(Cow::Borrowed("Dream Pop")));
}
#[test]
#[test_log::test]
fn genre_id_brackets() {
let tag = id3v2_tag_with_genre("(21)");
assert_eq!(tag.genre(), Some(Cow::Borrowed("Ska")));
}
#[test]
#[test_log::test]
fn genre_id_numeric() {
let tag = id3v2_tag_with_genre("21");
assert_eq!(tag.genre(), Some(Cow::Borrowed("Ska")));
}
#[test]
#[test_log::test]
fn genre_id_multiple_joined() {
let tag = id3v2_tag_with_genre("(51)(39)");
assert_eq!(
@ -1060,7 +1060,7 @@ fn genre_id_multiple_joined() {
);
}
#[test]
#[test_log::test]
fn genres_id_multiple() {
let tag = id3v2_tag_with_genre("(51)(39)");
let mut genres = tag.genres().unwrap();
@ -1069,7 +1069,7 @@ fn genres_id_multiple() {
assert_eq!(genres.next(), None);
}
#[test]
#[test_log::test]
fn genres_id_multiple_into_tag() {
let id3v2 = id3v2_tag_with_genre("(51)(39)");
let tag: Tag = id3v2.into();
@ -1079,7 +1079,7 @@ fn genres_id_multiple_into_tag() {
assert_eq!(genres.next(), None);
}
#[test]
#[test_log::test]
fn genres_null_separated() {
let tag = id3v2_tag_with_genre("Samba-rock\0MPB\0Funk");
let mut genres = tag.genres().unwrap();
@ -1089,7 +1089,7 @@ fn genres_null_separated() {
assert_eq!(genres.next(), None);
}
#[test]
#[test_log::test]
fn genres_id_textual_refinement() {
let tag = id3v2_tag_with_genre("(4)Eurodisco");
let mut genres = tag.genres().unwrap();
@ -1098,7 +1098,7 @@ fn genres_id_textual_refinement() {
assert_eq!(genres.next(), None);
}
#[test]
#[test_log::test]
fn genres_id_bracketed_refinement() {
let tag = id3v2_tag_with_genre("(26)(55)((I think...)");
let mut genres = tag.genres().unwrap();
@ -1108,7 +1108,7 @@ fn genres_id_bracketed_refinement() {
assert_eq!(genres.next(), None);
}
#[test]
#[test_log::test]
fn genres_id_remix_cover() {
let tag = id3v2_tag_with_genre("(0)(RX)(CR)");
let mut genres = tag.genres().unwrap();
@ -1118,7 +1118,7 @@ fn genres_id_remix_cover() {
assert_eq!(genres.next(), None);
}
#[test]
#[test_log::test]
fn tipl_round_trip() {
let mut tag = Id3v2Tag::default();
let mut tipl = KeyValueFrame::new(
@ -1166,7 +1166,7 @@ fn tipl_round_trip() {
}
}
#[test]
#[test_log::test]
fn flag_item_conversion() {
let mut tag = Tag::new(TagType::Id3v2);
tag.insert_text(ItemKey::FlagCompilation, "1".to_owned());
@ -1183,7 +1183,7 @@ fn flag_item_conversion() {
);
}
#[test]
#[test_log::test]
fn itunes_advisory_roundtrip() {
use crate::mp4::{AdvisoryRating, Ilst};
@ -1205,7 +1205,7 @@ fn itunes_advisory_roundtrip() {
assert_eq!(tag.advisory_rating(), Some(AdvisoryRating::Explicit));
}
#[test]
#[test_log::test]
fn timestamp_roundtrip() {
let mut tag = Id3v2Tag::default();
tag.insert(Frame::Timestamp(TimestampFrame::new(
@ -1246,7 +1246,7 @@ fn timestamp_roundtrip() {
}
}
#[test]
#[test_log::test]
fn special_items_roundtrip() {
let mut tag = Id3v2Tag::new();
@ -1311,7 +1311,7 @@ fn special_items_roundtrip() {
assert_eq!(tag_re_read, generic_tag_re_read);
}
#[test]
#[test_log::test]
fn preserve_comment_lang_description_on_conversion() {
let mut tag = Id3v2Tag::new();
@ -1342,7 +1342,7 @@ fn preserve_comment_lang_description_on_conversion() {
}
// TODO: Remove this once we have a better solution
#[test]
#[test_log::test]
fn hold_back_4_character_txxx_description() {
let mut tag = Id3v2Tag::new();
@ -1355,7 +1355,7 @@ fn hold_back_4_character_txxx_description() {
assert_eq!(tag.len(), 1);
}
#[test]
#[test_log::test]
fn skip_reading_cover_art() {
let p = Picture::new_unchecked(
PictureType::CoverFront,
@ -1377,7 +1377,7 @@ fn skip_reading_cover_art() {
assert!(id3v2.artist().is_some());
}
#[test]
#[test_log::test]
fn remove_id3v24_frames_on_id3v23_save() {
let mut tag = Id3v2Tag::new();
@ -1401,7 +1401,7 @@ fn remove_id3v24_frames_on_id3v23_save() {
assert_eq!(tag_re_read.frames.len(), 0);
}
#[test]
#[test_log::test]
fn change_text_encoding_on_id3v23_save() {
let mut tag = Id3v2Tag::new();
@ -1426,7 +1426,7 @@ fn change_text_encoding_on_id3v23_save() {
}
}
#[test]
#[test_log::test]
fn split_tdor_on_id3v23_save() {
let mut tag = Id3v2Tag::new();
@ -1465,7 +1465,7 @@ fn split_tdor_on_id3v23_save() {
}
}
#[test]
#[test_log::test]
fn split_tdrc_on_id3v23_save() {
let mut tag = Id3v2Tag::new();

View file

@ -60,7 +60,7 @@ mod tests {
use crate::id3::v2::util::pairs::set_number;
use crate::tag::{ItemKey, ItemValue, TagItem};
#[test]
#[test_log::test]
fn whitespace_in_number() {
let item = TagItem::new(
ItemKey::TrackNumber,
@ -69,7 +69,7 @@ mod tests {
set_number(&item, |number| assert_eq!(number, 12));
}
#[test]
#[test_log::test]
fn empty_number_string() {
let item = TagItem::new(ItemKey::TrackNumber, ItemValue::Text(String::new()));
set_number(&item, |_| unreachable!("Should not be called"));

View file

@ -302,7 +302,7 @@ mod tests {
&[0xFF, 0x00, 0x00, 0xFF, 0x12, 0xB0, 0x05, 0xFF, 0x00, 0x00];
const EXPECTED: &[u8] = &[0xFF, 0x00, 0xFF, 0x12, 0xB0, 0x05, 0xFF, 0x00];
#[test]
#[test_log::test]
fn unsynchronized_stream() {
let reader = Cursor::new(UNSYNCHRONIZED_CONTENT);
let mut unsynchronized_reader = UnsynchronizedStream::new(reader);
@ -315,7 +315,7 @@ mod tests {
assert_eq!(final_content, EXPECTED);
}
#[test]
#[test_log::test]
fn unsynchronized_stream_large() {
// Create a buffer >10k to force a buffer reset
let reader = Cursor::new(UNSYNCHRONIZED_CONTENT.repeat(1000));
@ -330,7 +330,7 @@ mod tests {
assert_eq!(final_content, EXPECTED.repeat(1000));
}
#[test]
#[test_log::test]
fn unsynchronized_stream_should_not_replace_unrelated() {
const ORIGINAL_CONTENT: &[u8] = &[0xFF, 0x1A, 0xFF, 0xC0, 0x10, 0x01];
@ -357,17 +357,17 @@ mod tests {
) => {
$(
paste::paste! {
#[test]
#[test_log::test]
fn [<$int _synch>]() {
assert_eq!($original.synch().unwrap(), $new);
}
#[test]
#[test_log::test]
fn [<$int _unsynch>]() {
assert_eq!($original_unsync.unsynch(), $new_unsynch);
}
#[test]
#[test_log::test]
fn [<$int _widen>]() {
assert_eq!($original_widen.widening_synch(), $new_widen);
}

View file

@ -296,7 +296,7 @@ mod tests {
use crate::id3::v2::{Id3v2Tag, Id3v2TagFlags};
use crate::prelude::*;
#[test]
#[test_log::test]
fn id3v2_write_crc32() {
let mut tag = Id3v2Tag::default();
tag.set_artist(String::from("Foo artist"));

View file

@ -500,7 +500,7 @@ mod tests {
use std::io::Cursor;
#[test]
#[test_log::test]
fn parse_aiff_text() {
let expected_tag = AiffTextChunks {
name: Some(String::from("Foo title")),
@ -537,7 +537,7 @@ mod tests {
assert_eq!(expected_tag, parsed_tag);
}
#[test]
#[test_log::test]
fn aiff_text_re_read() {
let tag = crate::tag::utils::test_utils::read_path("tests/tags/assets/test.aiff_text");
let parsed_tag = super::super::read::read_from(
@ -567,7 +567,7 @@ mod tests {
assert_eq!(parsed_tag, temp_parsed_tag);
}
#[test]
#[test_log::test]
fn aiff_text_to_tag() {
let tag_bytes =
crate::tag::utils::test_utils::read_path("tests/tags/assets/test.aiff_text");
@ -597,7 +597,7 @@ mod tests {
assert!(comments.next().is_none());
}
#[test]
#[test_log::test]
fn tag_to_aiff_text() {
let mut tag = Tag::new(TagType::AiffText);
tag.insert_text(ItemKey::TrackTitle, String::from("Foo title"));
@ -627,7 +627,7 @@ mod tests {
assert!(aiff_text.comments.is_none());
}
#[test]
#[test_log::test]
fn zero_sized_text_chunks() {
let tag_bytes =
crate::tag::utils::test_utils::read_path("tests/tags/assets/zero.aiff_text");

View file

@ -364,7 +364,7 @@ mod tests {
use std::io::Cursor;
#[test]
#[test_log::test]
fn parse_riff_info() {
let mut expected_tag = RiffInfoList::default();
@ -389,7 +389,7 @@ mod tests {
assert_eq!(expected_tag, parsed_tag);
}
#[test]
#[test_log::test]
fn riff_info_re_read() {
let tag = crate::tag::utils::test_utils::read_path("tests/tags/assets/test.riff");
let mut parsed_tag = RiffInfoList::default();
@ -421,7 +421,7 @@ mod tests {
assert_eq!(parsed_tag, temp_parsed_tag);
}
#[test]
#[test_log::test]
fn riff_info_to_tag() {
let tag_bytes = crate::tag::utils::test_utils::read_path("tests/tags/assets/test.riff");
@ -441,7 +441,7 @@ mod tests {
crate::tag::utils::test_utils::verify_tag(&tag, true, false);
}
#[test]
#[test_log::test]
fn tag_to_riff_info() {
let tag = crate::tag::utils::test_utils::create_tag(TagType::RiffInfo);

View file

@ -841,7 +841,7 @@ mod tests {
assert_eq!(atom.data().next().unwrap(), data);
}
#[test]
#[test_log::test]
fn parse_ilst() {
let mut expected_tag = Ilst::default();
@ -911,7 +911,7 @@ mod tests {
assert_eq!(expected_tag, parsed_tag);
}
#[test]
#[test_log::test]
fn ilst_re_read() {
let parsed_tag = read_ilst_strict("tests/tags/assets/ilst/test.ilst");
@ -934,7 +934,7 @@ mod tests {
assert_eq!(parsed_tag, temp_parsed_tag);
}
#[test]
#[test_log::test]
fn ilst_to_tag() {
let tag = crate::tag::utils::test_utils::read_path("tests/tags/assets/ilst/test.ilst");
let len = tag.len();
@ -957,7 +957,7 @@ mod tests {
assert_eq!(tag.get_string(&ItemKey::DiscTotal), Some("2"));
}
#[test]
#[test_log::test]
fn tag_to_ilst() {
let mut tag = crate::tag::utils::test_utils::create_tag(TagType::Mp4Ilst);
@ -1009,7 +1009,7 @@ mod tests {
)
}
#[test]
#[test_log::test]
fn issue_34() {
let ilst = read_ilst_strict("tests/tags/assets/ilst/issue_34.ilst");
@ -1028,7 +1028,7 @@ mod tests {
)
}
#[test]
#[test_log::test]
fn advisory_rating() {
let ilst = read_ilst_strict("tests/tags/assets/ilst/advisory_rating.ilst");
@ -1041,7 +1041,7 @@ mod tests {
assert_eq!(ilst.advisory_rating(), Some(AdvisoryRating::Explicit));
}
#[test]
#[test_log::test]
fn trailing_padding() {
const ILST_START: usize = 97;
const ILST_END: usize = 131;
@ -1106,7 +1106,7 @@ mod tests {
assert!(Mp4File::read_from(&mut file, ParseOptions::new().read_properties(false)).is_ok());
}
#[test]
#[test_log::test]
fn read_non_full_meta_atom() {
let file_bytes = read_path("tests/files/assets/non_full_meta_atom.m4a");
let file = Mp4File::read_from(
@ -1118,7 +1118,7 @@ mod tests {
assert!(file.ilst_tag.is_some());
}
#[test]
#[test_log::test]
fn write_non_full_meta_atom() {
// This is testing writing to a file with a non-full meta atom
// We will *not* write a non-full meta atom
@ -1147,7 +1147,7 @@ mod tests {
);
}
#[test]
#[test_log::test]
fn multi_value_atom() {
let ilst = read_ilst_strict("tests/tags/assets/ilst/multi_value_atom.ilst");
let artist_atom = ilst.get(&AtomIdent::Fourcc(*b"\xa9ART")).unwrap();
@ -1168,7 +1168,7 @@ mod tests {
);
}
#[test]
#[test_log::test]
fn multi_value_roundtrip() {
let mut tag = Tag::new(TagType::Mp4Ilst);
tag.insert_text(ItemKey::TrackArtist, "TrackArtist 1".to_owned());
@ -1231,7 +1231,7 @@ mod tests {
assert_eq!(tag.items, split_tag.items);
}
#[test]
#[test_log::test]
fn zero_sized_ilst() {
let file = Mp4File::read_from(
&mut Cursor::new(test_utils::read_path("tests/files/assets/zero/zero.ilst")),
@ -1242,7 +1242,7 @@ mod tests {
assert_eq!(file.ilst(), Some(&Ilst::default()));
}
#[test]
#[test_log::test]
fn merge_insert() {
let mut ilst = Ilst::new();
@ -1258,7 +1258,7 @@ mod tests {
assert_eq!(ilst.len(), 1);
}
#[test]
#[test_log::test]
fn invalid_atom_type() {
let ilst = read_ilst_strict("tests/tags/assets/ilst/invalid_atom_type.ilst");
@ -1272,7 +1272,7 @@ mod tests {
assert_eq!(ilst.disk_total().unwrap(), 2);
}
#[test]
#[test_log::test]
fn invalid_string_encoding() {
let ilst = read_ilst_bestattempt("tests/tags/assets/ilst/invalid_string_encoding.ilst");
@ -1287,7 +1287,7 @@ mod tests {
assert!(ilst.album().is_none());
}
#[test]
#[test_log::test]
fn flag_item_conversion() {
let mut tag = Tag::new(TagType::Mp4Ilst);
tag.insert_text(ItemKey::FlagCompilation, "1".to_owned());
@ -1312,7 +1312,7 @@ mod tests {
);
}
#[test]
#[test_log::test]
fn special_items_roundtrip() {
let mut tag = Ilst::new();
@ -1360,7 +1360,7 @@ mod tests {
assert_eq!(tag_re_read, generic_tag_re_read);
}
#[test]
#[test_log::test]
fn skip_reading_cover_art() {
let p = Picture::new_unchecked(
PictureType::CoverFront,

View file

@ -787,7 +787,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn integer_shrinking_unsigned() {
int_test! {
func: bytes_to_occupy_uint,

View file

@ -401,7 +401,7 @@ mod tests {
use std::io::{Cursor, Read, Seek, SeekFrom};
#[test]
#[test_log::test]
fn search_for_frame_sync() {
fn test(data: &[u8], expected_result: Option<u64>) {
use super::search_for_frame_sync;
@ -413,7 +413,7 @@ mod tests {
test(&[0x01, 0xFF], None);
}
#[test]
#[test_log::test]
#[rustfmt::skip]
fn rev_search_for_frame_header() {
fn test<R: Read + Seek>(reader: &mut R, expected_reader_position: Option<u64>) {

View file

@ -726,7 +726,7 @@ mod tests {
.unwrap()
}
#[test]
#[test_log::test]
fn parse_vorbis_comments() {
let mut expected_tag = VorbisComments::default();
@ -746,7 +746,7 @@ mod tests {
assert_eq!(expected_tag, parsed_tag);
}
#[test]
#[test_log::test]
fn vorbis_comments_re_read() {
let file_cont = crate::tag::utils::test_utils::read_path("tests/tags/assets/test.vorbis");
let mut parsed_tag = read_tag(&file_cont);
@ -764,7 +764,7 @@ mod tests {
assert_eq!(parsed_tag, temp_parsed_tag);
}
#[test]
#[test_log::test]
fn vorbis_comments_to_tag() {
let tag_bytes = std::fs::read("tests/tags/assets/test.vorbis").unwrap();
let vorbis_comments = read_tag(&tag_bytes);
@ -774,7 +774,7 @@ mod tests {
crate::tag::utils::test_utils::verify_tag(&tag, true, true);
}
#[test]
#[test_log::test]
fn tag_to_vorbis_comments() {
let tag = crate::tag::utils::test_utils::create_tag(TagType::VorbisComments);
@ -788,7 +788,7 @@ mod tests {
assert_eq!(vorbis_comments.get("GENRE"), Some("Classical"));
}
#[test]
#[test_log::test]
fn multi_value_roundtrip() {
let mut tag = Tag::new(TagType::VorbisComments);
tag.insert_text(ItemKey::TrackArtist, "TrackArtist 1".to_owned());
@ -868,13 +868,13 @@ mod tests {
assert_eq!(vorbis_comments1.items, vorbis_comments2.items);
}
#[test]
#[test_log::test]
fn zero_sized_vorbis_comments() {
let tag_bytes = std::fs::read("tests/tags/assets/zero.vorbis").unwrap();
let _ = read_tag(&tag_bytes);
}
#[test]
#[test_log::test]
fn issue_60() {
let tag_bytes = std::fs::read("tests/tags/assets/issue_60.vorbis").unwrap();
let tag = read_tag(&tag_bytes);
@ -883,7 +883,7 @@ mod tests {
assert!(tag.items.is_empty());
}
#[test]
#[test_log::test]
fn initial_key_roundtrip() {
// Both the primary and alternate key should be mapped to the primary
// key if stored again. Note: The outcome is undefined if both the
@ -901,7 +901,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn skip_reading_cover_art() {
let p = Picture::new_unchecked(
PictureType::CoverFront,

View file

@ -553,7 +553,7 @@ mod tests {
use std::fs::File;
#[test]
#[test_log::test]
fn mp3_id3v2_trailing_junk() {
// test data that contains 4 bytes of junk (0x20) between the ID3 portion and the first MP3 frame
let data: [&[u8]; 4] = [
@ -579,7 +579,7 @@ mod tests {
assert_eq!(probe.file_type(), Some(FileType::Mpeg));
}
#[test]
#[test_log::test]
fn parse_options_allocation_limit() {
// In this test, we read a partial MP3 file that has an ID3v2 tag containing a frame outside
// of the allocation limit. We'll be testing with an encrypted frame, since we immediately read those into memory.
@ -689,62 +689,62 @@ mod tests {
assert_eq!(probe.file_type(), Some(expected_file_type_guess));
}
#[test]
#[test_log::test]
fn probe_aac() {
test_probe("tests/files/assets/minimal/untagged.aac", FileType::Aac);
}
#[test]
#[test_log::test]
fn probe_aac_with_id3v2() {
test_probe("tests/files/assets/minimal/full_test.aac", FileType::Aac);
}
#[test]
#[test_log::test]
fn probe_aiff() {
test_probe("tests/files/assets/minimal/full_test.aiff", FileType::Aiff);
}
#[test]
#[test_log::test]
fn probe_ape_with_id3v2() {
test_probe("tests/files/assets/minimal/full_test.ape", FileType::Ape);
}
#[test]
#[test_log::test]
fn probe_flac() {
test_probe("tests/files/assets/minimal/full_test.flac", FileType::Flac);
}
#[test]
#[test_log::test]
fn probe_flac_with_id3v2() {
test_probe("tests/files/assets/flac_with_id3v2.flac", FileType::Flac);
}
#[test]
#[test_log::test]
fn probe_mp3_with_id3v2() {
test_probe("tests/files/assets/minimal/full_test.mp3", FileType::Mpeg);
}
#[test]
#[test_log::test]
fn probe_mp3_with_lots_of_junk() {
test_probe("tests/files/assets/junk.mp3", FileType::Mpeg);
}
#[test]
#[test_log::test]
fn probe_vorbis() {
test_probe("tests/files/assets/minimal/full_test.ogg", FileType::Vorbis);
}
#[test]
#[test_log::test]
fn probe_opus() {
test_probe("tests/files/assets/minimal/full_test.opus", FileType::Opus);
}
#[test]
#[test_log::test]
fn probe_speex() {
test_probe("tests/files/assets/minimal/full_test.spx", FileType::Speex);
}
#[test]
#[test_log::test]
fn probe_mp4() {
test_probe(
"tests/files/assets/minimal/m4a_codec_aac.m4a",
@ -752,7 +752,7 @@ mod tests {
);
}
#[test]
#[test_log::test]
fn probe_wav() {
test_probe(
"tests/files/assets/minimal/wav_format_pcm.wav",

View file

@ -293,7 +293,7 @@ where
audio_file.properties().clone()
}
#[test]
#[test_log::test]
fn aac_properties() {
assert_eq!(
get_properties::<AacFile>("tests/files/assets/minimal/full_test.aac"),
@ -301,7 +301,7 @@ fn aac_properties() {
);
}
#[test]
#[test_log::test]
fn aiff_properties() {
assert_eq!(
get_properties::<AiffFile>("tests/files/assets/minimal/full_test.aiff"),
@ -309,7 +309,7 @@ fn aiff_properties() {
);
}
#[test]
#[test_log::test]
fn ape_properties() {
assert_eq!(
get_properties::<ApeFile>("tests/files/assets/minimal/full_test.ape"),
@ -317,7 +317,7 @@ fn ape_properties() {
);
}
#[test]
#[test_log::test]
fn flac_properties() {
assert_eq!(
get_properties::<FlacFile>("tests/files/assets/minimal/full_test.flac"),
@ -325,7 +325,7 @@ fn flac_properties() {
)
}
#[test]
#[test_log::test]
fn mp1_properties() {
assert_eq!(
get_properties::<MpegFile>("tests/files/assets/minimal/full_test.mp1"),
@ -333,7 +333,7 @@ fn mp1_properties() {
)
}
#[test]
#[test_log::test]
fn mp2_properties() {
assert_eq!(
get_properties::<MpegFile>("tests/files/assets/minimal/full_test.mp2"),
@ -341,7 +341,7 @@ fn mp2_properties() {
)
}
#[test]
#[test_log::test]
fn mp3_properties() {
assert_eq!(
get_properties::<MpegFile>("tests/files/assets/minimal/full_test.mp3"),
@ -349,7 +349,7 @@ fn mp3_properties() {
)
}
#[test]
#[test_log::test]
fn mp4_aac_properties() {
assert_eq!(
get_properties::<Mp4File>("tests/files/assets/minimal/m4a_codec_aac.m4a"),
@ -357,7 +357,7 @@ fn mp4_aac_properties() {
)
}
#[test]
#[test_log::test]
fn mp4_alac_properties() {
assert_eq!(
get_properties::<Mp4File>("tests/files/assets/minimal/m4a_codec_alac.m4a"),
@ -365,7 +365,7 @@ fn mp4_alac_properties() {
)
}
#[test]
#[test_log::test]
fn mp4_als_properties() {
assert_eq!(
get_properties::<Mp4File>("tests/files/assets/minimal/mp4_codec_als.mp4"),
@ -373,7 +373,7 @@ fn mp4_als_properties() {
)
}
#[test]
#[test_log::test]
fn mp4_flac_properties() {
assert_eq!(
get_properties::<Mp4File>("tests/files/assets/minimal/mp4_codec_flac.mp4"),
@ -381,7 +381,7 @@ fn mp4_flac_properties() {
)
}
#[test]
#[test_log::test]
fn mpc_sv5_properties() {
assert_eq!(
get_properties::<MpcFile>("tests/files/assets/minimal/mpc_sv5.mpc"),
@ -389,7 +389,7 @@ fn mpc_sv5_properties() {
)
}
#[test]
#[test_log::test]
fn mpc_sv7_properties() {
assert_eq!(
get_properties::<MpcFile>("tests/files/assets/minimal/mpc_sv7.mpc"),
@ -397,7 +397,7 @@ fn mpc_sv7_properties() {
)
}
#[test]
#[test_log::test]
fn mpc_sv8_properties() {
assert_eq!(
get_properties::<MpcFile>("tests/files/assets/minimal/mpc_sv8.mpc"),
@ -405,7 +405,7 @@ fn mpc_sv8_properties() {
)
}
#[test]
#[test_log::test]
fn opus_properties() {
assert_eq!(
get_properties::<OpusFile>("tests/files/assets/minimal/full_test.opus"),
@ -413,7 +413,7 @@ fn opus_properties() {
)
}
#[test]
#[test_log::test]
fn speex_properties() {
assert_eq!(
get_properties::<SpeexFile>("tests/files/assets/minimal/full_test.spx"),
@ -421,7 +421,7 @@ fn speex_properties() {
)
}
#[test]
#[test_log::test]
fn vorbis_properties() {
assert_eq!(
get_properties::<VorbisFile>("tests/files/assets/minimal/full_test.ogg"),
@ -429,7 +429,7 @@ fn vorbis_properties() {
)
}
#[test]
#[test_log::test]
fn wav_properties() {
assert_eq!(
get_properties::<WavFile>("tests/files/assets/minimal/wav_format_pcm.wav"),
@ -437,7 +437,7 @@ fn wav_properties() {
)
}
#[test]
#[test_log::test]
fn wavpack_properties() {
assert_eq!(
get_properties::<WavPackFile>("tests/files/assets/minimal/full_test.wv"),

View file

@ -189,7 +189,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn custom_resolver() {
register_custom_resolver::<MyFile>("MyFile");

View file

@ -240,7 +240,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn timestamp_decode() {
let content = "2024-06-03T14:08:49";
let parsed_timestamp =
@ -249,7 +249,7 @@ mod tests {
assert_eq!(parsed_timestamp, Some(expected()));
}
#[test]
#[test_log::test]
fn timestamp_decode_no_zero() {
// Zeroes are not used
let content = "2024-6-3T14:8:49";
@ -260,7 +260,7 @@ mod tests {
assert_eq!(parsed_timestamp, Some(expected()));
}
#[test]
#[test_log::test]
fn timestamp_decode_zero_substitution() {
// Zeros are replaced by spaces
let content = "2024- 6- 3T14: 8:49";
@ -271,13 +271,13 @@ mod tests {
assert_eq!(parsed_timestamp, Some(expected()));
}
#[test]
#[test_log::test]
fn timestamp_encode() {
let encoded = expected().to_string();
assert_eq!(encoded, "2024-06-03T14:08:49");
}
#[test]
#[test_log::test]
fn timestamp_encode_invalid() {
let mut timestamp = expected();
@ -286,7 +286,7 @@ mod tests {
assert_eq!(timestamp.to_string().len(), 7);
}
#[test]
#[test_log::test]
fn reject_broken_timestamps() {
let broken_timestamps: &[&[u8]] = &[
b"2024-",
@ -304,7 +304,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn timestamp_decode_partial() {
let partial_timestamps: [(&[u8], Timestamp); 6] = [
(
@ -361,7 +361,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn empty_timestamp() {
let empty_timestamp =
Timestamp::parse(&mut "".as_bytes(), ParsingMode::BestAttempt).unwrap();

View file

@ -752,7 +752,7 @@ mod tests {
use std::io::{Seek, Write};
use std::process::Command;
#[test]
#[test_log::test]
fn issue_37() {
let file_contents = read_path("tests/files/assets/issue_37.ogg");
let mut temp_file = tempfile::NamedTempFile::new().unwrap();
@ -784,7 +784,7 @@ mod tests {
);
}
#[test]
#[test_log::test]
fn issue_130_huge_picture() {
// Verify we have opus-tools available, otherwise skip
match Command::new("opusinfo").output() {
@ -824,7 +824,7 @@ mod tests {
assert!(!stderr.contains("WARNING:"));
}
#[test]
#[test_log::test]
fn should_preserve_empty_title() {
let mut tag = Tag::new(TagType::Id3v2);
tag.set_title(String::from("Foo title"));
@ -838,7 +838,7 @@ mod tests {
assert_eq!(tag.title(), None);
}
#[test]
#[test_log::test]
fn try_parse_year_with_leading_trailing_whitespace_and_various_formats() {
assert_eq!(Some(1983), try_parse_year("\t 1983\n"));
assert_eq!(Some(1983), try_parse_year("1983-1"));
@ -850,7 +850,7 @@ mod tests {
assert_eq!(Some(1983), try_parse_year("1983-01-02T10:24:08.001Z"));
}
#[test]
#[test_log::test]
fn should_not_parse_year_from_less_than_4_digits() {
assert!(try_parse_year("198").is_none());
assert!(try_parse_year("19").is_none());

View file

@ -83,7 +83,7 @@ impl<T> VecFallibleCapacity<T> for Vec<T> {
mod tests {
use crate::util::alloc::fallible_vec_from_element;
#[test]
#[test_log::test]
fn vec_fallible_repeat() {
let u8_vec_len_20 = fallible_vec_from_element(0u8, 20).unwrap();
assert_eq!(u8_vec_len_20.len(), 20);

View file

@ -277,7 +277,7 @@ mod tests {
tag.set_artist(String::from("Foo artist"));
}
#[test]
#[test_log::test]
fn io_save_to_file() {
// Read the file and change the artist
let mut file = file();
@ -309,7 +309,7 @@ mod tests {
assert_eq!(current_file_contents, test_asset_contents());
}
#[test]
#[test_log::test]
fn io_save_to_vec() {
// Same test as above, but using a Cursor<Vec<u8>> instead of a file
let mut file = file();
@ -333,7 +333,7 @@ mod tests {
assert_eq!(current_file_contents, test_asset_contents());
}
#[test]
#[test_log::test]
fn io_save_using_references() {
struct File {
buf: Vec<u8>,

View file

@ -96,7 +96,7 @@ impl F80 {
mod tests {
use super::*;
#[test]
#[test_log::test]
fn test_div_round() {
#[derive(Debug)]
struct TestEntry {
@ -129,7 +129,7 @@ mod tests {
}
}
#[test]
#[test_log::test]
fn test_f80() {
fn cmp_float_nearly_equal(a: f64, b: f64) -> bool {
if a.is_infinite() && b.is_infinite() {

View file

@ -344,7 +344,7 @@ mod tests {
const TEST_STRING: &str = "l\u{00f8}ft\u{00a5}";
#[test]
#[test_log::test]
fn text_decode() {
// No BOM
let utf16_decode = super::utf16_decode_bytes(
@ -386,7 +386,7 @@ mod tests {
assert_eq!(utf8_decode.content, TEST_STRING.to_string());
}
#[test]
#[test_log::test]
fn text_encode() {
// No BOM
let utf16_encode = super::utf16_encode(TEST_STRING, u16::to_be_bytes, true, false);

View file

@ -7,7 +7,7 @@ use lofty::tag::TagType;
use std::io::Seek;
#[test]
#[test_log::test]
fn read() {
// Here we have an AAC file with an ID3v2, and an ID3v1 tag
let file = Probe::open("tests/files/assets/minimal/full_test.aac")
@ -25,7 +25,7 @@ fn read() {
crate::verify_artist!(file, tag, TagType::Id3v1, "Bar artist", 1);
}
#[test]
#[test_log::test]
fn read_with_junk_bytes_between_frames() {
// Read a file that includes an ID3v2.3 data block followed by four bytes of junk data (0x20)
@ -54,7 +54,7 @@ fn read_with_junk_bytes_between_frames() {
assert_eq!(id3v1_tag.title().as_deref(), Some("title test"));
}
#[test]
#[test_log::test]
fn write() {
let mut file = temp_file!("tests/files/assets/minimal/full_test.aac");
@ -87,22 +87,22 @@ fn write() {
crate::set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Baz artist", 1 => file, "Bar artist");
}
#[test]
#[test_log::test]
fn remove_id3v2() {
crate::remove_tag!("tests/files/assets/minimal/full_test.aac", TagType::Id3v2);
}
#[test]
#[test_log::test]
fn remove_id3v1() {
crate::remove_tag!("tests/files/assets/minimal/full_test.aac", TagType::Id3v1);
}
#[test]
#[test_log::test]
fn read_no_properties() {
crate::no_properties_test!("tests/files/assets/minimal/full_test.aac");
}
#[test]
#[test_log::test]
fn read_no_tags() {
crate::no_tag_test!("tests/files/assets/minimal/full_test.aac");
}

View file

@ -7,7 +7,7 @@ use lofty::tag::TagType;
use std::io::Seek;
#[test]
#[test_log::test]
fn read() {
// Here we have an AIFF file with both an ID3v2 chunk and text chunks
let file = Probe::open("tests/files/assets/minimal/full_test.aiff")
@ -25,7 +25,7 @@ fn read() {
crate::verify_artist!(file, tag, TagType::AiffText, "Bar artist", 1);
}
#[test]
#[test_log::test]
fn write() {
let mut file = temp_file!("tests/files/assets/minimal/full_test.aiff");
@ -58,7 +58,7 @@ fn write() {
crate::set_artist!(tagged_file, tag_mut, TagType::AiffText, "Baz artist", 1 => file, "Bar artist");
}
#[test]
#[test_log::test]
fn remove_text_chunks() {
crate::remove_tag!(
"tests/files/assets/minimal/full_test.aiff",
@ -66,17 +66,17 @@ fn remove_text_chunks() {
);
}
#[test]
#[test_log::test]
fn remove_id3v2() {
crate::remove_tag!("tests/files/assets/minimal/full_test.aiff", TagType::Id3v2);
}
#[test]
#[test_log::test]
fn read_no_properties() {
crate::no_properties_test!("tests/files/assets/minimal/full_test.aiff");
}
#[test]
#[test_log::test]
fn read_no_tags() {
crate::no_tag_test!("tests/files/assets/minimal/full_test.aiff");
}

View file

@ -7,7 +7,7 @@ use lofty::tag::TagType;
use std::io::Seek;
#[test]
#[test_log::test]
fn read() {
// Here we have an APE file with an ID3v2, ID3v1, and an APEv2 tag
let file = Probe::open("tests/files/assets/minimal/full_test.ape")
@ -28,7 +28,7 @@ fn read() {
crate::verify_artist!(file, tag, TagType::Id3v2, "Baz artist", 1);
}
#[test]
#[test_log::test]
fn write() {
// We don't write an ID3v2 tag here since it's against the spec
let mut file = temp_file!("tests/files/assets/minimal/full_test.ape");
@ -62,27 +62,27 @@ fn write() {
crate::set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Baz artist", 1 => file, "Bar artist");
}
#[test]
#[test_log::test]
fn remove_ape() {
crate::remove_tag!("tests/files/assets/minimal/full_test.ape", TagType::Ape);
}
#[test]
#[test_log::test]
fn remove_id3v1() {
crate::remove_tag!("tests/files/assets/minimal/full_test.ape", TagType::Id3v1);
}
#[test]
#[test_log::test]
fn remove_id3v2() {
crate::remove_tag!("tests/files/assets/minimal/full_test.ape", TagType::Id3v2);
}
#[test]
#[test_log::test]
fn read_no_properties() {
crate::no_properties_test!("tests/files/assets/minimal/full_test.ape");
}
#[test]
#[test_log::test]
fn read_no_tags() {
crate::no_tag_test!("tests/files/assets/minimal/full_test.ape");
}

View file

@ -8,7 +8,7 @@ use lofty::flac::FlacFile;
use lofty::ogg::VorbisComments;
use lofty::prelude::*;
#[test]
#[test_log::test]
fn multiple_vorbis_comments() {
let mut file = File::open("tests/files/assets/two_vorbis_comments.flac").unwrap();
@ -34,17 +34,17 @@ fn multiple_vorbis_comments() {
);
}
#[test]
#[test_log::test]
fn read_no_properties() {
crate::no_properties_test!("tests/files/assets/minimal/full_test.flac");
}
#[test]
#[test_log::test]
fn read_no_tags() {
crate::no_tag_test!("tests/files/assets/minimal/full_test.flac");
}
#[test]
#[test_log::test]
fn retain_vendor_string() {
let mut file = temp_file!("tests/files/assets/minimal/full_test.flac");

View file

@ -7,7 +7,7 @@ use lofty::tag::TagType;
use std::io::Seek;
#[test]
#[test_log::test]
fn read() {
// This file contains an ilst atom
let file = Probe::open("tests/files/assets/minimal/m4a_codec_aac.m4a")
@ -22,7 +22,7 @@ fn read() {
crate::verify_artist!(file, primary_tag, "Foo artist", 1);
}
#[test]
#[test_log::test]
fn write() {
let mut file = temp_file!("tests/files/assets/minimal/m4a_codec_aac.m4a");
@ -51,7 +51,7 @@ fn write() {
crate::set_artist!(tagged_file, tag_mut, TagType::Mp4Ilst, "Bar artist", 1 => file, "Foo artist");
}
#[test]
#[test_log::test]
fn remove() {
crate::remove_tag!(
"tests/files/assets/minimal/m4a_codec_aac.m4a",
@ -59,12 +59,12 @@ fn remove() {
);
}
#[test]
#[test_log::test]
fn read_no_properties() {
crate::no_properties_test!("tests/files/assets/minimal/m4a_codec_aac.m4a");
}
#[test]
#[test_log::test]
fn read_no_tags() {
crate::no_tag_test!("tests/files/assets/minimal/m4a_codec_aac.m4a");
}

View file

@ -9,13 +9,13 @@ use lofty::tag::TagType;
use std::io::Seek;
// Marker test so IntelliJ Rust recognizes this as a test module
#[test]
#[test_log::test]
fn fake() {}
macro_rules! generate_tests {
($stream_version:ident, $path:literal) => {
paste::paste! {
#[test]
#[test_log::test]
fn [<read_ $stream_version>]() {
// Here we have an MPC file with an ID3v2, ID3v1, and an APEv2 tag
let file = Probe::open($path)
@ -37,7 +37,7 @@ macro_rules! generate_tests {
}
#[test]
#[test_log::test]
fn [<write_ $stream_version>]() {
let mut file = temp_file!($path);
@ -65,27 +65,27 @@ macro_rules! generate_tests {
crate::set_artist!(tagged_file, primary_tag_mut, "Bar artist", 1 => file, "Foo artist");
}
#[test]
#[test_log::test]
fn [<remove_id3v2_ $stream_version>]() {
crate::remove_tag!($path, TagType::Id3v2);
}
#[test]
#[test_log::test]
fn [<remove_id3v1_ $stream_version>]() {
crate::remove_tag!($path, TagType::Id3v1);
}
#[test]
#[test_log::test]
fn [<remove_ape_ $stream_version>]() {
crate::remove_tag!($path, TagType::Ape);
}
#[test]
#[test_log::test]
fn [<read_no_properties_ $stream_version>]() {
crate::no_properties_test!($path);
}
#[test]
#[test_log::test]
fn [<read_no_tags_ $stream_version>]() {
crate::no_tag_test!($path);
}
@ -98,7 +98,7 @@ generate_tests!(sv7, "tests/files/assets/minimal/mpc_sv7.mpc");
// We have to use `MpcFile::read_from` for stream versions <= 6
#[test]
#[test_log::test]
fn read_sv5() {
let mut file = temp_file!("tests/files/assets/minimal/mpc_sv5.mpc");

View file

@ -10,7 +10,7 @@ use lofty::tag::{Tag, TagType};
use std::borrow::Cow;
use std::io::Seek;
#[test]
#[test_log::test]
fn read() {
// Here we have an MP3 file with an ID3v2, ID3v1, and an APEv2 tag
let file = Probe::open("tests/files/assets/minimal/full_test.mp3")
@ -31,7 +31,7 @@ fn read() {
crate::verify_artist!(file, tag, TagType::Ape, "Baz artist", 1);
}
#[test]
#[test_log::test]
fn read_with_junk_bytes_between_frames() {
// Read a file that includes an ID3v2.3 data block followed by four bytes of junk data (0x20)
let file = Probe::open("tests/files/assets/junk_between_id3_and_mp3.mp3")
@ -57,7 +57,7 @@ fn read_with_junk_bytes_between_frames() {
assert_eq!(id3v1_tag.title().as_deref(), Some("title test"));
}
#[test]
#[test_log::test]
fn issue_82_solidus_in_tag() {
let file = Probe::open("tests/files/assets/issue_82_solidus_in_tag.mp3")
.unwrap()
@ -70,7 +70,7 @@ fn issue_82_solidus_in_tag() {
assert_eq!(id3v2_tag.title().as_deref(), Some("Foo / title"));
}
#[test]
#[test_log::test]
fn issue_87_duplicate_id3v2() {
// The first tag has a bunch of information: An album, artist, encoder, and a title.
// This tag is immediately followed by another the contains an artist.
@ -93,7 +93,7 @@ fn issue_87_duplicate_id3v2() {
assert_eq!(id3v2_tag.title().as_deref(), Some("title test"));
}
#[test]
#[test_log::test]
fn write() {
let mut file = temp_file!("tests/files/assets/minimal/full_test.mp3");
@ -131,7 +131,7 @@ fn write() {
crate::set_artist!(tagged_file, tag_mut, TagType::Ape, "Qux artist", 1 => file, "Baz artist");
}
#[test]
#[test_log::test]
fn save_to_id3v2() {
let mut file = temp_file!("tests/files/assets/minimal/full_test.mp3");
@ -169,7 +169,7 @@ fn save_to_id3v2() {
assert!(tag.disk_total().is_none());
}
#[test]
#[test_log::test]
fn save_number_of_track_and_disk_to_id3v2() {
let mut file = temp_file!("tests/files/assets/minimal/full_test.mp3");
@ -210,7 +210,7 @@ fn save_number_of_track_and_disk_to_id3v2() {
assert!(tag.disk_total().is_none());
}
#[test]
#[test_log::test]
fn test_bound_tagged_into_inner() {
let file = temp_file!("tests/files/assets/minimal/full_test.mp3");
@ -233,7 +233,7 @@ fn test_bound_tagged_into_inner() {
assert_eq!(tag.disk(), Some(123));
}
#[test]
#[test_log::test]
fn save_total_of_track_and_disk_to_id3v2() {
let mut file = temp_file!("tests/files/assets/minimal/full_test.mp3");
@ -274,7 +274,7 @@ fn save_total_of_track_and_disk_to_id3v2() {
assert_eq!(tag.disk_total().unwrap(), disk_total);
}
#[test]
#[test_log::test]
fn save_number_pair_of_track_and_disk_to_id3v2() {
let mut file = temp_file!("tests/files/assets/minimal/full_test.mp3");
@ -320,22 +320,22 @@ fn save_number_pair_of_track_and_disk_to_id3v2() {
assert_eq!(tag.disk_total().unwrap(), disk_total);
}
#[test]
#[test_log::test]
fn remove_id3v2() {
crate::remove_tag!("tests/files/assets/minimal/full_test.mp3", TagType::Id3v2);
}
#[test]
#[test_log::test]
fn remove_id3v1() {
crate::remove_tag!("tests/files/assets/minimal/full_test.mp3", TagType::Id3v1);
}
#[test]
#[test_log::test]
fn remove_ape() {
crate::remove_tag!("tests/files/assets/minimal/full_test.mp3", TagType::Ape);
}
#[test]
#[test_log::test]
fn read_and_write_tpil_frame() {
let key_value_pairs = vec![
("engineer".to_string(), "testperson".to_string()),
@ -370,7 +370,7 @@ fn read_and_write_tpil_frame() {
assert_eq!(key_value_pairs, content.key_value_pairs);
}
#[test]
#[test_log::test]
fn read_no_properties() {
let mut file = crate::temp_file!("tests/files/assets/minimal/full_test.mp3");
let tagged_file = Probe::new(&mut file)
@ -388,7 +388,7 @@ fn read_no_properties() {
assert_eq!(properties.channels(), Some(0));
}
#[test]
#[test_log::test]
fn read_no_tags() {
crate::no_tag_test!("tests/files/assets/minimal/full_test.mp3");
}

View file

@ -10,17 +10,17 @@ use std::io::Seek;
// The tests for OGG Opus/Vorbis/Speex are nearly identical
// We have the vendor string and a title stored in the tag
#[test]
#[test_log::test]
fn opus_read() {
read("tests/files/assets/minimal/full_test.opus", FileType::Opus)
}
#[test]
#[test_log::test]
fn opus_write() {
write("tests/files/assets/minimal/full_test.opus", FileType::Opus)
}
#[test]
#[test_log::test]
fn opus_remove() {
remove(
"tests/files/assets/minimal/full_test.opus",
@ -28,18 +28,18 @@ fn opus_remove() {
)
}
#[test]
#[test_log::test]
fn flac_read() {
// FLAC does **not** require a Vorbis comment block be present, this file has one
read("tests/files/assets/minimal/full_test.flac", FileType::Flac)
}
#[test]
#[test_log::test]
fn flac_write() {
write("tests/files/assets/minimal/full_test.flac", FileType::Flac)
}
#[test]
#[test_log::test]
fn flac_remove_vorbis_comments() {
crate::remove_tag!(
"tests/files/assets/minimal/full_test.flac",
@ -47,17 +47,17 @@ fn flac_remove_vorbis_comments() {
);
}
#[test]
#[test_log::test]
fn vorbis_read() {
read("tests/files/assets/minimal/full_test.ogg", FileType::Vorbis)
}
#[test]
#[test_log::test]
fn vorbis_write() {
write("tests/files/assets/minimal/full_test.ogg", FileType::Vorbis)
}
#[test]
#[test_log::test]
fn vorbis_remove() {
remove(
"tests/files/assets/minimal/full_test.ogg",
@ -65,17 +65,17 @@ fn vorbis_remove() {
)
}
#[test]
#[test_log::test]
fn speex_read() {
read("tests/files/assets/minimal/full_test.spx", FileType::Speex)
}
#[test]
#[test_log::test]
fn speex_write() {
write("tests/files/assets/minimal/full_test.spx", FileType::Speex)
}
#[test]
#[test_log::test]
fn speex_remove() {
remove(
"tests/files/assets/minimal/full_test.spx",
@ -150,7 +150,7 @@ fn remove(path: &str, tag_type: TagType) {
assert_eq!(tagged_file.tag(tag_type).unwrap().item_count(), 1);
}
#[test]
#[test_log::test]
fn flac_with_id3v2() {
use lofty::flac::FlacFile;
@ -167,12 +167,12 @@ fn flac_with_id3v2() {
assert!(flac_file.vorbis_comments().is_some());
}
#[test]
#[test_log::test]
fn flac_remove_id3v2() {
crate::remove_tag!("tests/files/assets/flac_with_id3v2.flac", TagType::Id3v2);
}
#[test]
#[test_log::test]
fn flac_try_write_non_empty_id3v2() {
use lofty::id3::v2::Id3v2Tag;
@ -187,32 +187,32 @@ fn flac_try_write_non_empty_id3v2() {
.is_err());
}
#[test]
#[test_log::test]
fn read_no_properties_opus() {
crate::no_properties_test!("tests/files/assets/minimal/full_test.opus");
}
#[test]
#[test_log::test]
fn read_no_tags_opus() {
crate::no_tag_test!(@MANDATORY_TAG "tests/files/assets/minimal/full_test.opus", expected_len: 1);
}
#[test]
#[test_log::test]
fn read_no_properties_vorbis() {
crate::no_properties_test!("tests/files/assets/minimal/full_test.ogg");
}
#[test]
#[test_log::test]
fn read_no_tags_vorbis() {
crate::no_tag_test!(@MANDATORY_TAG "tests/files/assets/minimal/full_test.ogg", expected_len: 1);
}
#[test]
#[test_log::test]
fn read_no_properties_speex() {
crate::no_properties_test!("tests/files/assets/minimal/full_test.spx");
}
#[test]
#[test_log::test]
fn read_no_tags_speex() {
crate::no_tag_test!(@MANDATORY_TAG "tests/files/assets/minimal/full_test.spx", expected_len: 1);
}

View file

@ -7,7 +7,7 @@ use lofty::tag::TagType;
use std::io::Seek;
#[test]
#[test_log::test]
fn read() {
// Here we have a WAV file with both an ID3v2 chunk and a RIFF INFO chunk
let file = Probe::open("tests/files/assets/minimal/wav_format_pcm.wav")
@ -25,7 +25,7 @@ fn read() {
crate::verify_artist!(file, tag, TagType::RiffInfo, "Bar artist", 1);
}
#[test]
#[test_log::test]
fn write() {
let mut file = temp_file!("tests/files/assets/minimal/wav_format_pcm.wav");
@ -58,7 +58,7 @@ fn write() {
crate::set_artist!(tagged_file, tag_mut, TagType::RiffInfo, "Baz artist", 1 => file, "Bar artist");
}
#[test]
#[test_log::test]
fn remove_id3v2() {
crate::remove_tag!(
"tests/files/assets/minimal/wav_format_pcm.wav",
@ -66,7 +66,7 @@ fn remove_id3v2() {
);
}
#[test]
#[test_log::test]
fn remove_riff_info() {
crate::remove_tag!(
"tests/files/assets/minimal/wav_format_pcm.wav",
@ -74,7 +74,7 @@ fn remove_riff_info() {
);
}
#[test]
#[test_log::test]
fn issue_174_divide_by_zero() {
let file = Probe::open(
"tests/files/assets/issue_174_waveformatextensible-ieeefloat-44100Hz-mono95060.wav",
@ -86,12 +86,12 @@ fn issue_174_divide_by_zero() {
assert_eq!(file.file_type(), FileType::Wav);
}
#[test]
#[test_log::test]
fn read_no_properties() {
crate::no_properties_test!("tests/files/assets/minimal/wav_format_pcm.wav");
}
#[test]
#[test_log::test]
fn read_no_tags() {
crate::no_tag_test!("tests/files/assets/minimal/wav_format_pcm.wav");
}

View file

@ -7,7 +7,7 @@ use lofty::tag::TagType;
use std::io::Seek;
#[test]
#[test_log::test]
fn read() {
// Here we have a WacPack file with both an ID3v1 tag and an APE tag
let file = Probe::open("tests/files/assets/minimal/full_test.wv")
@ -25,7 +25,7 @@ fn read() {
crate::verify_artist!(file, tag, TagType::Id3v1, "Bar artist", 1);
}
#[test]
#[test_log::test]
fn write() {
let mut file = temp_file!("tests/files/assets/minimal/full_test.wv");
@ -58,22 +58,22 @@ fn write() {
set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Baz artist", 1 => file, "Bar artist");
}
#[test]
#[test_log::test]
fn remove_id3v1() {
crate::remove_tag!("tests/files/assets/minimal/full_test.wv", TagType::Id3v1);
}
#[test]
#[test_log::test]
fn remove_ape() {
crate::remove_tag!("tests/files/assets/minimal/full_test.wv", TagType::Ape);
}
#[test]
#[test_log::test]
fn read_no_properties() {
crate::no_properties_test!("tests/files/assets/minimal/full_test.wv");
}
#[test]
#[test_log::test]
fn read_no_tags() {
crate::no_tag_test!("tests/files/assets/minimal/full_test.wv");
}

View file

@ -23,7 +23,7 @@ fn read_file_no_properties<A: AudioFile>(path: &str) -> bool {
res.is_ok()
}
#[test]
#[test_log::test]
fn zero_audio_aiff() {
let path = "tests/files/assets/zero/zero.aiff";
@ -33,7 +33,7 @@ fn zero_audio_aiff() {
assert!(read_file_no_properties::<AiffFile>(path));
}
#[test]
#[test_log::test]
fn zero_audio_ape() {
let path = "tests/files/assets/zero/zero.ape";
@ -43,14 +43,14 @@ fn zero_audio_ape() {
assert!(read_file_no_properties::<ApeFile>(path))
}
#[test]
#[test_log::test]
fn zero_audio_flac() {
let path = "tests/files/assets/zero/zero.flac";
assert!(read_file_with_properties::<FlacFile>(path));
assert!(read_file_no_properties::<FlacFile>(path));
}
#[test]
#[test_log::test]
fn zero_audio_mp3() {
let path = "tests/files/assets/zero/zero.mp3";
// A zero-size MP3 will error, since we need MPEG frames to extract audio properties
@ -59,7 +59,7 @@ fn zero_audio_mp3() {
assert!(read_file_no_properties::<MpegFile>(path))
}
#[test]
#[test_log::test]
fn zero_audio_mp4() {
let path = "tests/files/assets/zero/zero.mp4";
@ -71,7 +71,7 @@ fn zero_audio_mp4() {
// zero-size Vorbis, Opus, and Speex files are invalid
#[test]
#[test_log::test]
fn zero_audio_wav() {
let path = "tests/files/assets/zero/zero.wav";
// An empty "data" chunk is an error

View file

@ -2,7 +2,7 @@ use lofty::aac::AacFile;
use lofty::config::ParseOptions;
use lofty::file::AudioFile;
#[test]
#[test_log::test]
fn panic1() {
let mut reader = crate::get_reader(
"aacfile_read_from/01 - aalborg_IDX_9_RAND_168952727934877251846138.mp3",

View file

@ -3,12 +3,12 @@ use lofty::config::ParseOptions;
use lofty::file::AudioFile;
use lofty::iff::aiff::AiffFile;
#[test]
#[test_log::test]
fn oom1() {
oom_test::<AiffFile>("aifffile_read_from/oom-88065007d35ee271d5812fd723a3b458488813ea");
}
#[test]
#[test_log::test]
fn panic1() {
let mut reader =
get_reader("aifffile_read_from/full_test_IDX_5_RAND_89430166450532348786207.aiff");

View file

@ -3,12 +3,12 @@ use lofty::config::ParseOptions;
use lofty::file::AudioFile;
use lofty::flac::FlacFile;
#[test]
#[test_log::test]
fn oom1() {
oom_test::<FlacFile>("flacfile_read_from/oom-9268264e9bc5e2124e4d63cbff8cff0b0dec6644");
}
#[test]
#[test_log::test]
fn panic1() {
let mut reader =
get_reader("flacfile_read_from/flac_with_id3v2_IDX_39_RAND_108668567929800767822112.flac");

View file

@ -1,6 +1,6 @@
use lofty::id3::v2::FrameFlags;
#[test]
#[test_log::test]
fn unreachable1() {
// https://github.com/Serial-ATA/lofty-rs/issues/295
let data = [1, 0, 0, 0];
@ -16,7 +16,7 @@ fn unreachable1() {
);
}
#[test]
#[test_log::test]
fn overflow1() {
// https://github.com/Serial-ATA/lofty-rs/issues/295
let data = [

View file

@ -3,12 +3,12 @@ use lofty::config::ParseOptions;
use lofty::file::AudioFile;
use lofty::mp4::Mp4File;
#[test]
#[test_log::test]
fn oom1() {
oom_test::<Mp4File>("mp4file_read_from/oom-db2665d79ec9c045bdb9c1e9a3d0c93e7e59393e");
}
#[test]
#[test_log::test]
fn panic1() {
let mut reader = crate::get_reader(
"mp4file_read_from/steam_at_mention_IDX_34_RAND_4491956654166691611931.m4a",
@ -16,7 +16,7 @@ fn panic1() {
let _ = Mp4File::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn panic2() {
let mut reader = crate::get_reader(
"mp4file_read_from/steam_at_mention_IDX_33_RAND_122808229373977607781108.m4a",
@ -24,7 +24,7 @@ fn panic2() {
let _ = Mp4File::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn panic3() {
let mut reader = crate::get_reader(
"mp4file_read_from/steam_at_mention_IDX_60_RAND_135276517902742448802109.m4a",
@ -32,7 +32,7 @@ fn panic3() {
let _ = Mp4File::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn panic4() {
let mut reader = crate::get_reader(
"mp4file_read_from/steam_at_mention_IDX_83_RAND_107070306175668418039559.m4a",
@ -40,7 +40,7 @@ fn panic4() {
let _ = Mp4File::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn panic5() {
let mut reader = crate::get_reader(
"mp4file_read_from/steam_at_mention_IDX_97_RAND_34488648178055098192895.m4a",
@ -48,7 +48,7 @@ fn panic5() {
let _ = Mp4File::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn panic6() {
let mut reader = crate::get_reader(
"mp4file_read_from/ui_steam_smoother_friend_join_IDX_53_RAND_83672409887817275057956.m4a",

View file

@ -3,7 +3,7 @@ use lofty::file::AudioFile;
use lofty::musepack::MpcFile;
// Overflow when passing an AAC file to MpcFile::read_from
#[test]
#[test_log::test]
fn panic1() {
let mut reader = crate::get_reader("mpcfile_read_from/output.aac");
let _ = MpcFile::read_from(&mut reader, ParseOptions::new());

View file

@ -3,7 +3,7 @@ use lofty::config::ParseOptions;
use lofty::mpeg::MpegFile;
use lofty::prelude::*;
#[test]
#[test_log::test]
fn crash1() {
let mut reader =
get_reader("mpegfile_read_from/crash-9b17818b6404b1c4b9f89c09dc11e915b96cafc6");
@ -11,7 +11,7 @@ fn crash1() {
let _ = MpegFile::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn crash2() {
let mut reader =
get_reader("mpegfile_read_from/crash-718f75611e77caac968c7f68cdefa1472172f64b");
@ -19,7 +19,7 @@ fn crash2() {
let _ = MpegFile::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn oom1() {
oom_test::<MpegFile>("mpegfile_read_from/oom-f8730cbfa5682ab12343ccb70de9b71a061ef4d0");
}

View file

@ -1,7 +1,7 @@
use crate::oom_test;
use lofty::ogg::OpusFile;
#[test]
#[test_log::test]
fn oom1() {
oom_test::<OpusFile>("opusfile_read_from/oom-7126e68a5a9ef53351c46f3c55b7e1a582705fcc");
}

View file

@ -2,7 +2,7 @@ use crate::get_reader;
use lofty::error::ErrorKind;
use lofty::picture::PictureInformation;
#[test]
#[test_log::test]
fn crash1() {
let reader =
get_reader("pictureinformation_from_jpeg/crash-e46c53f85ca87dd374bc5c4e73c2f66f3a45b955");

View file

@ -1,7 +1,7 @@
use crate::get_reader;
use lofty::picture::PictureInformation;
#[test]
#[test_log::test]
fn crash1() {
let reader =
get_reader("pictureinformation_from_png/crash-9cca0ac668e4735a0aac8eddb91a50b9351b419c");

View file

@ -1,7 +1,7 @@
use crate::oom_test;
use lofty::ogg::SpeexFile;
#[test]
#[test_log::test]
fn oom1() {
oom_test::<SpeexFile>("speexfile_read_from/oom-7976a4c57e7f8b4ac428f9e7f846b59d2dce714f");
}

View file

@ -3,19 +3,19 @@ use lofty::config::ParseOptions;
use lofty::file::AudioFile;
use lofty::ogg::VorbisFile;
#[test]
#[test_log::test]
fn oom1() {
oom_test::<VorbisFile>("vorbisfile_read_from/oom-436193bc2d1664b74c19720bef08697d03284f06");
}
#[test]
#[test_log::test]
fn large_allocation() {
let mut reader =
crate::get_reader("vorbisfile_read_from/move01d_IDX_13_RAND_35154275996070165946691.ogg");
let _ = VorbisFile::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn panic1() {
let mut reader =
crate::get_reader("vorbisfile_read_from/order01d_IDX_32_RAND_22064097693866277502540.ogg");

View file

@ -3,26 +3,26 @@ use lofty::config::ParseOptions;
use lofty::file::AudioFile;
use lofty::iff::wav::WavFile;
#[test]
#[test_log::test]
fn oom1() {
oom_test::<WavFile>("wavfile_read_from/oom-007573d233b412ea1b8038137db28e70d5678291");
}
#[test]
#[test_log::test]
fn panic1() {
let mut reader =
crate::get_reader("wavfile_read_from/2_IDX_0_RAND_85629492689553753214598.wav");
let _ = WavFile::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn panic2() {
let mut reader =
crate::get_reader("wavfile_read_from/2_IDX_63_RAND_104275228651573584855676.wav");
let _ = WavFile::read_from(&mut reader, ParseOptions::new());
}
#[test]
#[test_log::test]
fn panic3() {
let mut reader =
crate::get_reader("wavfile_read_from/2_IDX_34_RAND_128635499166458268533001.wav");

View file

@ -1,84 +1,84 @@
use crate::oom_test;
use lofty::wavpack::WavPackFile;
#[test]
#[test_log::test]
fn oom1() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-1e67c08d7f69bc3ac39aeeede515b96fffcb31b4",
);
}
#[test]
#[test_log::test]
fn oom2() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-3f74da5ead463d922c1de1f57ad7ac9697e3f79d",
);
}
#[test]
#[test_log::test]
fn oom3() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-7eae56cca38a302e693fcbc3853798f6298c5e90",
);
}
#[test]
#[test_log::test]
fn oom4() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-7f1d89b3c498ff9a180cfdb85ab3b51f25756991",
);
}
#[test]
#[test_log::test]
fn oom5() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-56e6e9ffb1642607fb9aba7f7613667882a4fd0c",
);
}
#[test]
#[test_log::test]
fn oom6() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-68b3837442b17e87863f02299e0cce1c4145c76b",
);
}
#[test]
#[test_log::test]
fn oom7() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-94867b6fefcd32cd5bc3bc298468cd3d65d93ff1",
);
}
#[test]
#[test_log::test]
fn oom8() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-625824728fdaa4cbc0acb6e58a2737f60c7446f8",
);
}
#[test]
#[test_log::test]
fn oom9() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-aa6f3592d16b7845dea49b6f261e4c6fbd9a2143",
);
}
#[test]
#[test_log::test]
fn oom10() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-cdb6b62e519b2f42c6c376ad125679c83a11f6cf",
);
}
#[test]
#[test_log::test]
fn oom11() {
oom_test::<WavPackFile>(
"wavpackfile_read_from/minimized-from-e08dd883f7816664aa627662e0674706b47e76db",
);
}
#[test]
#[test_log::test]
fn oom12() {
oom_test::<WavPackFile>("wavpackfile_read_from/oom-94867b6fefcd32cd5bc3bc298468cd3d65d93ff1");
}

View file

@ -15,7 +15,7 @@ fn get_properties(path: &Path) -> Result<<WavFile as AudioFile>::Properties> {
Ok(*wav_file.properties())
}
#[test]
#[test_log::test]
fn hound() {
let paths = fs::read_dir("tests/files/assets/hound").unwrap();
@ -35,7 +35,7 @@ fn hound() {
}
}
#[test]
#[test_log::test]
fn hound_fuzz() {
let paths = fs::read_dir("tests/files/assets/hound/fuzz").unwrap();

View file

@ -26,7 +26,7 @@ fn create_original_picture() -> Picture {
original_pic
}
#[test]
#[test_log::test]
fn id3v24_apic() {
let buf = get_buf("tests/picture/assets/png_640x628.apic");
@ -36,7 +36,7 @@ fn id3v24_apic() {
assert_eq!(create_original_picture(), apic.picture);
}
#[test]
#[test_log::test]
fn as_apic_bytes() {
let buf = get_buf("tests/picture/assets/png_640x628.apic");
@ -48,7 +48,7 @@ fn as_apic_bytes() {
assert_eq!(buf, original_as_apic);
}
#[test]
#[test_log::test]
fn id3v22_pic() {
let buf = get_buf("tests/picture/assets/png_640x628.pic");
@ -58,7 +58,7 @@ fn id3v22_pic() {
assert_eq!(create_original_picture(), pic.picture);
}
#[test]
#[test_log::test]
fn as_apic_bytes_v2() {
let buf = get_buf("tests/picture/assets/png_640x628.pic");
@ -70,7 +70,7 @@ fn as_apic_bytes_v2() {
assert_eq!(buf, original_as_pic);
}
#[test]
#[test_log::test]
fn ape_binary_item() {
let buf = get_buf("tests/picture/assets/png_640x628.apev2");
@ -79,7 +79,7 @@ fn ape_binary_item() {
assert_eq!(create_original_picture(), pic);
}
#[test]
#[test_log::test]
fn as_ape_bytes() {
let buf = get_buf("tests/picture/assets/png_640x628.apev2");
@ -90,7 +90,7 @@ fn as_ape_bytes() {
assert_eq!(buf, original_as_ape);
}
#[test]
#[test_log::test]
fn flac_metadata_block_picture() {
let buf = get_buf("tests/picture/assets/png_640x628.vorbis");
@ -99,7 +99,7 @@ fn flac_metadata_block_picture() {
assert_eq!(create_original_picture(), pic);
}
#[test]
#[test_log::test]
fn as_flac_bytes() {
let buf = get_buf("tests/picture/assets/png_640x628.vorbis");

View file

@ -12,14 +12,14 @@ fn get_buf(path: &str) -> Vec<u8> {
buf
}
#[test]
#[test_log::test]
fn picture_from_reader_png() {
let pic = Picture::from_reader(&mut &*get_buf("tests/picture/assets/png_640x628.png")).unwrap();
assert_eq!(pic.mime_type(), Some(&MimeType::Png));
}
#[test]
#[test_log::test]
fn picture_from_reader_jpeg() {
let pic =
Picture::from_reader(&mut &*get_buf("tests/picture/assets/jpeg_640x628.jpg")).unwrap();
@ -27,21 +27,21 @@ fn picture_from_reader_jpeg() {
assert_eq!(pic.mime_type(), Some(&MimeType::Jpeg));
}
#[test]
#[test_log::test]
fn picture_from_reader_bmp() {
let pic = Picture::from_reader(&mut &*get_buf("tests/picture/assets/bmp_640x628.bmp")).unwrap();
assert_eq!(pic.mime_type(), Some(&MimeType::Bmp));
}
#[test]
#[test_log::test]
fn picture_from_reader_gif() {
let pic = Picture::from_reader(&mut &*get_buf("tests/picture/assets/gif_640x628.gif")).unwrap();
assert_eq!(pic.mime_type(), Some(&MimeType::Gif));
}
#[test]
#[test_log::test]
fn picture_from_reader_tiff() {
let pic =
Picture::from_reader(&mut &*get_buf("tests/picture/assets/tiff_640x628.tiff")).unwrap();

View file

@ -3,7 +3,7 @@ use lofty::picture::PictureInformation;
use std::fs::File;
use std::io::Read;
#[test]
#[test_log::test]
fn read_png() {
// 640x628
let mut f = File::open("tests/picture/assets/png_640x628.png").unwrap();
@ -21,7 +21,7 @@ fn read_png() {
assert_eq!(information.num_colors, 0);
}
#[test]
#[test_log::test]
fn read_png_plte() {
// PNG image with a PLTE chunk (indexed color)
let mut f = File::open("tests/picture/assets/png_640x628_plte.png").unwrap();
@ -40,7 +40,7 @@ fn read_png_plte() {
assert_eq!(information.num_colors, 118);
}
#[test]
#[test_log::test]
fn read_jpeg() {
let mut f = File::open("tests/picture/assets/jpeg_640x628.jpg").unwrap();

View file

@ -6,7 +6,7 @@ use lofty::TextEncoding;
use std::borrow::Cow;
#[test]
#[test_log::test]
fn tag_to_id3v2_lang_frame() {
let mut tag = Tag::new(TagType::Id3v2);
tag.insert_text(ItemKey::Lyrics, String::from("Test lyrics"));