headers: add negative unit tests

This commit is contained in:
aler9
2021-04-26 19:39:20 +02:00
parent 262f283400
commit c1cd32257f
6 changed files with 71 additions and 7 deletions

View File

@@ -191,20 +191,23 @@ func TestRTPInfoReadError(t *testing.T) {
for _, ca := range []struct {
name string
hv base.HeaderValue
err string
}{
{
"empty",
base.HeaderValue{},
"value not provided",
},
{
"2 values",
base.HeaderValue{"a", "b"},
"value provided multiple times ([a b])",
},
} {
t.Run(ca.name, func(t *testing.T) {
var h RTPInfo
err := h.Read(ca.hv)
require.Error(t, err)
require.Equal(t, ca.err, err.Error())
})
}
}