From ba2ed28ef7de3f3a458e038c71620b45790112d6 Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 19 Jun 2026 16:58:18 -0400 Subject: [PATCH] refactor(lyrics): move test-only parseTTML/parseSRT wrappers to test files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- model/lyrics_srt.go | 4 ---- model/lyrics_srt_test.go | 5 +++++ model/lyrics_ttml.go | 4 ---- model/lyrics_ttml_test.go | 5 +++++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/model/lyrics_srt.go b/model/lyrics_srt.go index 342e2548f..82b2eaa6c 100644 --- a/model/lyrics_srt.go +++ b/model/lyrics_srt.go @@ -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") diff --git a/model/lyrics_srt_test.go b/model/lyrics_srt_test.go index 60523e090..5e2de991f 100644 --- a/model/lyrics_srt_test.go +++ b/model/lyrics_srt_test.go @@ -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") diff --git a/model/lyrics_ttml.go b/model/lyrics_ttml.go index 2e089f0b3..16d8467b4 100644 --- a/model/lyrics_ttml.go +++ b/model/lyrics_ttml.go @@ -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 { diff --git a/model/lyrics_ttml_test.go b/model/lyrics_ttml_test.go index 323e6841c..c9d9e193f 100644 --- a/model/lyrics_ttml_test.go +++ b/model/lyrics_ttml_test.go @@ -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() {