package lyrics import "testing" // FuzzParse guards against a crash/panic in the LRC parser when fed // arbitrary bytes — lyrics come from sidecar files and embedded tags // found while scanning a music library, so the content is effectively // untrusted input. func FuzzParse(f *testing.F) { f.Add("[00:12.34]First line\n[00:15.00]Second line") f.Add("[la:en]\n[00:12.34]<00:12.34>Hello <00:12.90>world") f.Add("") f.Add("[not a tag") f.Add("[99:99.999999999999]overflowing timestamp") f.Add("[00:12.34][00:15.00]shared timestamp line") f.Add("no timestamps at all, just plain text") f.Fuzz(func(t *testing.T, content string) { defer func() { if r := recover(); r != nil { t.Fatalf("Parse panicked on %q: %v", content, r) } }() Parse(content) }) }