From e670494adfe00a1fa55c7e8ffcbf0172ff662cce Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 20 Apr 2026 09:25:00 +0300 Subject: Fix task 25 comic generation leak handling --- internal/comic/localization_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'internal/comic/localization_test.go') diff --git a/internal/comic/localization_test.go b/internal/comic/localization_test.go index 8855732..9da0f11 100644 --- a/internal/comic/localization_test.go +++ b/internal/comic/localization_test.go @@ -55,6 +55,17 @@ func TestFindImageLeakMarker(t *testing.T) { } } +func TestFindEnglishLeakWord(t *testing.T) { + t.Parallel() + + if word, ok := findEnglishLeakWord("спокойна сцена"); ok || word != "" { + t.Fatalf("findEnglishLeakWord() = %q, %v, want no match", word, ok) + } + if word, ok := findEnglishLeakWord("page 1 of 5"); !ok || word != "page" { + t.Fatalf("findEnglishLeakWord() = %q, %v, want page match", word, ok) + } +} + func TestComicStylesStayComic(t *testing.T) { t.Parallel() @@ -64,3 +75,26 @@ func TestComicStylesStayComic(t *testing.T) { } } } + +func TestContainsLatinLetters(t *testing.T) { + t.Parallel() + + if containsLatinLetters("Здравей") { + t.Fatal("containsLatinLetters() = true for Cyrillic text") + } + if !containsLatinLetters("Page 4 of 5") { + t.Fatal("containsLatinLetters() = false for Latin text") + } +} + +func TestLocalizedStylePrompt(t *testing.T) { + t.Parallel() + + got := localizedStylePrompt("classic American comic book with bold ink outlines, halftone dots, and primary colors", "Bulgarian", "Cyrillic") + if containsLatinLetters(got) { + t.Fatalf("localizedStylePrompt() = %q, want no Latin letters", got) + } + if got == "" { + t.Fatal("localizedStylePrompt() returned empty string") + } +} -- cgit v1.2.3