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 committed 2026-06-19 16:58:18 -04:00
1 parent fd700f8d8a
commit ba2ed28ef7
4 files changed
+10 -8

No files matched your search

-4
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")
+5
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")
-4
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 {
+5
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() {