Skip to content

Commit

Permalink
Add invalid repeat times unmarshal test
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghaowillow authored and stv0g committed Aug 8, 2023
1 parent ac6517e commit 18a7702
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "testing"

func FuzzUnmarshal(f *testing.F) {
f.Add([]byte{})
f.Add([]byte(CanonicalMarshalSDP))
f.Add([]byte(CanonicalUnmarshalSDP))
f.Fuzz(func(t *testing.T, data []byte) {
// Check that unmarshalling any byte slice does not panic.
var sd SessionDescription
Expand Down
5 changes: 5 additions & 0 deletions unmarshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@ func TestUnmarshalRepeatTimes(t *testing.T) {
if string(actual) != RepeatTimesSDPExpected {
t.Errorf("error:\n\nEXPECTED:\n%v\nACTUAL:\n%v", RepeatTimesSDPExpected, string(actual))
}

err = sd.Unmarshal([]byte(TimingSDP + "r=\r\n"))
if got, want := err, errSDPInvalidValue; !errors.Is(got, want) {
t.Fatalf("Marshal(): err=%v, want %v", got, want)
}
}

func TestUnmarshalTimeZones(t *testing.T) {
Expand Down

0 comments on commit 18a7702

Please sign in to comment.