Skip to content

Commit

Permalink
Tests: Add TagLib RIFF INFO tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Serial-ATA committed Jan 15, 2023
1 parent 3179959 commit 1e5c0ca
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/taglib/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ mod test_fileref;
mod test_flac;
mod test_flacpicture;
mod test_id3v1;
mod test_info;
2 changes: 1 addition & 1 deletion tests/taglib/test_apetag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
30 changes: 30 additions & 0 deletions tests/taglib/test_info.rs
Original file line number Diff line number Diff line change
@@ -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"));
}

0 comments on commit 1e5c0ca

Please sign in to comment.