Fix existing tests

This commit is contained in:
Serial 2021-04-06 16:37:31 -04:00
parent a56417ffe4
commit f9d8981ca2
6 changed files with 14 additions and 11 deletions

5
.gitignore vendored
View file

@ -7,4 +7,7 @@
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
**/*.rs.bk
# Project configuration
/.idea/

View file

@ -86,7 +86,7 @@ impl AudioTagEdit for FlacTag {
}
fn artists(&self) -> Option<Vec<&str>> {
todo!()
self.artist().map(|a| a.split(", ").collect())
}
fn remove_artist(&mut self) {

View file

@ -91,7 +91,7 @@ impl AudioTagEdit for Id3v2Tag {
}
fn artists(&self) -> Option<Vec<&str>> {
todo!()
self.artist().map(|a| a.split(", ").collect())
}
fn remove_artist(&mut self) {

View file

@ -131,7 +131,7 @@ impl AudioTagEdit for OpusTag {
}
fn artists(&self) -> Option<Vec<&str>> {
todo!()
self.artist().map(|a| a.split(", ").collect())
}
fn remove_artist(&mut self) {

View file

@ -29,15 +29,15 @@
//! use lofty::{Tag, TagType};
//!
//! // Guess the format from the extension, in this case `mp3`
//! let mut tag = Tag::new().read_from_path("assets/a.mp3").unwrap();
//! let mut tag = Tag::new().read_from_path("tests/assets/a.mp3").unwrap();
//! tag.set_title("Foo");
//!
//! // You can convert the tag type and save the metadata to another file.
//! tag.to_dyn_tag(TagType::Mp4).write_to_path("assets/a.m4a");
//! tag.to_dyn_tag(TagType::Mp4).write_to_path("tests/assets/a.m4a");
//!
//! // You can specify the tag type, but when you want to do this
//! // also consider directly using the concrete type
//! let tag = Tag::new().with_tag_type(TagType::Mp4).read_from_path("assets/a.m4a").unwrap();
//! let tag = Tag::new().with_tag_type(TagType::Mp4).read_from_path("tests/assets/a.m4a").unwrap();
//! assert_eq!(tag.title(), Some("Foo"));
//! ```
//!

View file

@ -9,11 +9,11 @@ fn test_inner() {
let tag: FlacTag = innertag.into();
let mut id3tag = tag.to_dyn_tag(TagType::Id3v2);
id3tag
.write_to_path("assets/a.mp3")
.write_to_path("tests/assets/a.mp3")
.expect("Fail to write!");
let id3tag_reload = Tag::default()
.read_from_path("assets/a.mp3")
.read_from_path("tests/assets/a.mp3")
.expect("Fail to read!");
assert_eq!(id3tag_reload.title(), Some("title from metaflac::Tag"));
@ -29,9 +29,9 @@ fn test_inner() {
};
id3tag_inner.set_date_recorded(timestamp.clone());
id3tag_inner
.write_to_path("assets/a.mp3", id3::Version::Id3v24)
.write_to_path("tests/assets/a.mp3", id3::Version::Id3v24)
.expect("Fail to write!");
let id3tag_reload = id3::Tag::read_from_path("assets/a.mp3").expect("Fail to read!");
let id3tag_reload = id3::Tag::read_from_path("tests/assets/a.mp3").expect("Fail to read!");
assert_eq!(id3tag_reload.date_recorded(), Some(timestamp));
}