mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2025-03-13 09:42:39 +00:00
Merge 92fa631095
into 381ac7732f
This commit is contained in:
commit
32548302d5
1 changed files with 21 additions and 3 deletions
|
@ -526,11 +526,10 @@ fn duration_title_tag(i: &[u8]) -> IResult<&[u8], (f32, Option<String>)> {
|
|||
tuple((
|
||||
float,
|
||||
opt(char(',')),
|
||||
opt(map_res(is_not("\r\n,"), from_utf8_slice)),
|
||||
opt(map_res(is_not("\r\n"), from_utf8_slice)),
|
||||
take(1usize),
|
||||
opt(char(',')),
|
||||
)),
|
||||
|(duration, _, title, _, _)| (duration, title),
|
||||
|(duration, _, title, _)| (duration, title),
|
||||
)(i)
|
||||
}
|
||||
|
||||
|
@ -995,6 +994,25 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_duration_title_with_commas() {
|
||||
assert_eq!(
|
||||
duration_title_tag(b"2.002,title,with,commas\nrest"),
|
||||
Result::Ok((
|
||||
"rest".as_bytes(),
|
||||
(2.002f32, Some("title,with,commas".to_string()))
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_duration_title_without_title() {
|
||||
assert_eq!(
|
||||
duration_title_tag(b"2.002\nrest"),
|
||||
Result::Ok(("rest".as_bytes(), (2.002f32, None)))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn incomplete_manifest() {
|
||||
assert!(!is_master_playlist(
|
||||
|
|
Loading…
Reference in a new issue