improve coverage

This commit is contained in:
aler9
2021-05-23 16:44:54 +02:00
parent 53e8f32bd0
commit 47dca4d0ac
3 changed files with 37 additions and 2 deletions

View File

@@ -10,23 +10,32 @@ func TestURLError(t *testing.T) {
for _, ca := range []struct {
name string
enc string
err string
}{
{
"invalid",
"testing",
":testing",
"parse \":testing\": missing protocol scheme",
},
{
"unsupported scheme",
"http://testing",
"unsupported scheme 'http'",
},
{
"with opaque data",
"rtsp:opaque?query",
"URLs with opaque data are not supported",
},
{
"with fragment",
"rtsp://localhost:8554/teststream#fragment",
"URLs with fragments are not supported",
},
} {
t.Run(ca.name, func(t *testing.T) {
_, err := ParseURL(ca.enc)
require.Error(t, err)
require.Equal(t, ca.err, err.Error())
})
}
}