@@ -69,3 +69,31 @@ fn zero_size_id3v2() {
6969 let header = read_id3v2_header ( & mut f) . unwrap ( ) ;
7070 assert ! ( parse_id3v2( & mut f, header, ParsingMode :: Strict ) . is_ok( ) ) ;
7171}
72+
73+ #[ test]
74+ fn bad_frame_id_relaxed_id3v2 ( ) {
75+ use crate :: id3:: v2:: read_id3v2_header;
76+ use crate :: { Accessor , ParsingMode , TagExt } ;
77+ use std:: io:: Cursor ;
78+
79+ // Contains a frame with a "+" in the ID, which is invalid.
80+ // All other frames in the tag are valid, however.
81+ let mut f = Cursor :: new (
82+ std:: fs:: read ( "tests/tags/assets/id3v2/bad_frame_otherwise_valid.id3v24" ) . unwrap ( ) ,
83+ ) ;
84+ let header = read_id3v2_header ( & mut f) . unwrap ( ) ;
85+ let id3v2 = parse_id3v2 ( & mut f, header, ParsingMode :: Relaxed ) ;
86+ assert ! ( id3v2. is_ok( ) ) ;
87+
88+ let id3v2 = id3v2. unwrap ( ) ;
89+
90+ // There are 6 valid frames and 1 invalid frame
91+ assert_eq ! ( id3v2. len( ) , 6 ) ;
92+
93+ assert_eq ! ( id3v2. title( ) . as_deref( ) , Some ( "Foo title" ) ) ;
94+ assert_eq ! ( id3v2. artist( ) . as_deref( ) , Some ( "Bar artist" ) ) ;
95+ assert_eq ! ( id3v2. comment( ) . as_deref( ) , Some ( "Qux comment" ) ) ;
96+ assert_eq ! ( id3v2. year( ) , Some ( 1984 ) ) ;
97+ assert_eq ! ( id3v2. track( ) , Some ( 1 ) ) ;
98+ assert_eq ! ( id3v2. genre( ) . as_deref( ) , Some ( "Classical" ) ) ;
99+ }
0 commit comments