diff --git a/tests/taglib/main.rs b/tests/taglib/main.rs index 76b9f13ee..6b5eb5821 100644 --- a/tests/taglib/main.rs +++ b/tests/taglib/main.rs @@ -7,3 +7,4 @@ mod test_fileref; mod test_flac; mod test_flacpicture; mod test_id3v1; +mod test_info; diff --git a/tests/taglib/test_apetag.rs b/tests/taglib/test_apetag.rs index 56d9e1429..e8f5d8a05 100644 --- a/tests/taglib/test_apetag.rs +++ b/tests/taglib/test_apetag.rs @@ -78,7 +78,7 @@ fn test_invalid_keys() { let mut tag = ApeTag::default(); tag.insert(valid_space_and_tilde.unwrap()); tag.insert(valid_normal_one.unwrap()); - assert_eq!(tag.items().len(), 2); + assert_eq!(tag.len(), 2); } #[test] diff --git a/tests/taglib/test_info.rs b/tests/taglib/test_info.rs new file mode 100644 index 000000000..f1bce457d --- /dev/null +++ b/tests/taglib/test_info.rs @@ -0,0 +1,30 @@ +use lofty::iff::wav::RIFFInfoList; +use lofty::Accessor; + +#[test] +fn test_title() { + let mut tag = RIFFInfoList::default(); + + assert!(tag.title().is_none()); + tag.set_title(String::from("Test title 1")); + tag.insert(String::from("TEST"), String::from("Dummy Text")); + + assert_eq!(tag.title().as_deref(), Some("Test title 1")); + assert_eq!(tag.get("INAM"), Some("Test title 1")); + assert_eq!(tag.get("TEST"), Some("Dummy Text")); +} + +#[test] +fn test_numeric_fields() { + let mut tag = RIFFInfoList::default(); + + assert!(tag.track().is_none()); + tag.set_track(1234); + assert_eq!(tag.track(), Some(1234)); + assert_eq!(tag.get("IPRT"), Some("1234")); + + assert!(tag.year().is_none()); + tag.set_year(1234); + assert_eq!(tag.year(), Some(1234)); + assert_eq!(tag.get("ICRD"), Some("1234")); +}