refactor(lyrics): move test-only parseTTML/parseSRT wrappers to test files

These zero-arg wrappers (defaulting lang to "xxx") had no production callers
after the consolidation — only the format tests used them. Move each beside
its tests so the production files carry no test-only code.
This commit is contained in:
Deluan 2026-06-19 16:58:18 -04:00
commit ba2ed28ef7
4 changed files with 10 additions and 8 deletions

View file

@ -14,10 +14,6 @@ var (
srtBlockSeparatorRegex = regexp.MustCompile(`\n\s*\n`)
)
func parseSRT(contents []byte) (LyricList, error) {
return parseSRTWithLanguage("xxx", contents)
}
func parseSRTWithLanguage(language string, contents []byte) (LyricList, error) {
raw := strings.ReplaceAll(string(contents), "\r\n", "\n")
raw = strings.ReplaceAll(raw, "\r", "\n")

View file

@ -5,6 +5,11 @@ import (
. "github.com/onsi/gomega"
)
// parseSRT parses with the default placeholder language, for test ergonomics.
func parseSRT(contents []byte) (LyricList, error) {
return parseSRTWithLanguage("xxx", contents)
}
var _ = Describe("parseSRT", func() {
It("parses SRT blocks with the default language", func() {
content := []byte("1\n00:00:01,000 --> 00:00:02,000\nFirst subtitle\n\n2\n00:00:03,000 --> 00:00:04,000\nSecond subtitle")

View file

@ -102,10 +102,6 @@ type ttmlParser struct {
metadataSeq int
}
func parseTTML(contents []byte) (LyricList, error) {
return parseTTMLWithDefaultLang("xxx", contents)
}
func isTTMLDocument(text string) bool {
decoder := xml.NewDecoder(strings.NewReader(strings.TrimSpace(text)))
for {

View file

@ -5,6 +5,11 @@ import (
. "github.com/onsi/gomega"
)
// parseTTML parses with the default placeholder language, for test ergonomics.
func parseTTML(contents []byte) (LyricList, error) {
return parseTTMLWithDefaultLang("xxx", contents)
}
var _ = Describe("parseTTML", func() {
Describe("Multi-language and timing", func() {
It("should parse multiple language divs with inherited offsets and frame/tick timing", func() {