Skip to content

Commit aa50837

Browse files
committed
Tests: Fix old Id3v2Tag tests
1 parent 9554295 commit aa50837

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/id3/v2/tag.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ impl Id3v2Tag {
159159

160160
impl Id3v2Tag {
161161
/// Gets a [`Frame`] from an id
162-
///
163-
/// NOTE: This is *not* case-sensitive
164162
pub fn get(&self, id: &FrameId<'_>) -> Option<&Frame<'static>> {
165163
self.frames.iter().find(|f| &f.id == id)
166164
}
@@ -208,7 +206,7 @@ impl Id3v2Tag {
208206
///
209207
/// tag.set_title(String::from("Foo\0Bar"));
210208
///
211-
/// let mut titles = tag.get_texts(&TITLE_ID);
209+
/// let mut titles = tag.get_texts(&TITLE_ID).expect("Should exist");
212210
///
213211
/// assert_eq!(titles.next(), Some("Foo"));
214212
/// assert_eq!(titles.next(), Some("Bar"));

tests/files/mpeg.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::{set_artist, temp_file, verify_artist};
2+
use std::borrow::Cow;
23

3-
use lofty::id3::v2::{Frame, FrameFlags, FrameValue, Id3v2Tag, KeyValueFrame};
4+
use lofty::id3::v2::{Frame, FrameFlags, FrameId, FrameValue, Id3v2Tag, KeyValueFrame};
45
use lofty::mpeg::MpegFile;
56
use lofty::{
67
Accessor, AudioFile, FileType, ItemKey, ItemValue, ParseOptions, Probe, Tag, TagExt, TagItem,
@@ -344,7 +345,11 @@ fn read_and_write_tpil_frame() {
344345

345346
let tag: &Id3v2Tag = mpeg_file.id3v2().unwrap();
346347

347-
let content = match tag.get("TIPL").unwrap().content() {
348+
let content = match tag
349+
.get(&FrameId::Valid(Cow::Borrowed("TIPL")))
350+
.unwrap()
351+
.content()
352+
{
348353
FrameValue::KeyValue(content) => content,
349354
_ => panic!("Wrong Frame Value Type for TIPL"),
350355
};

tests/tags/conversions.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Tests for special case conversions
22

3-
use lofty::id3::v2::{CommentFrame, Frame, FrameFlags, Id3v2Tag, UnsynchronizedTextFrame};
3+
use lofty::id3::v2::{CommentFrame, Frame, FrameFlags, FrameId, Id3v2Tag, UnsynchronizedTextFrame};
44
use lofty::{ItemKey, Tag, TagType, TextEncoding};
5+
use std::borrow::Cow;
56

67
#[test]
78
fn tag_to_id3v2_lang_frame() {
@@ -12,7 +13,7 @@ fn tag_to_id3v2_lang_frame() {
1213
let id3: Id3v2Tag = tag.into();
1314

1415
assert_eq!(
15-
id3.get("USLT"),
16+
id3.get(&FrameId::Valid(Cow::Borrowed("USLT"))),
1617
Frame::new(
1718
"USLT",
1819
UnsynchronizedTextFrame {
@@ -28,7 +29,7 @@ fn tag_to_id3v2_lang_frame() {
2829
);
2930

3031
assert_eq!(
31-
id3.get("COMM"),
32+
id3.get(&FrameId::Valid(Cow::Borrowed("COMM"))),
3233
Frame::new(
3334
"COMM",
3435
CommentFrame {

0 commit comments

Comments
 (0)