-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
In parseVariant(), we don't do much validation beyond type checking and parsing tokens before returning a Variant.
For example, Apple HLS authoring spec mentions that the CODECS attribute must be set for all variants.
There's some easy validation. After we've broken out of the loop reading items from the lexer, have a bunch of basic if statements checking stuff:
func parseVariant() {
var v Variant
for it := range items {
switch ... {
}
}
if v.Codecs == "" {
return nil, fmt.Errorf("codecs not set")
}
return v, nil
}
Not sure how to test this exactly. Two ways off the top of my head:
- make a
chan itemand send items through it. Pass the chan to parseVariant(). - decode simple playlists which have different "bad" variants in them.
However we do it, as long as it's easy to add new, readable test cases.
My first instinct is to go for option 2 as it feels clearer to have bad playlist specified as text as opposed to code with structs sent through channels.
Metadata
Metadata
Assignees
Labels
No labels