summaryrefslogtreecommitdiff
path: root/internal/comic/localization_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-20 09:25:00 +0300
committerPaul Buetow <paul@buetow.org>2026-04-20 09:25:00 +0300
commite670494adfe00a1fa55c7e8ffcbf0172ff662cce (patch)
treec1ec8902f2407ce1168289aa7521507da3b4bae2 /internal/comic/localization_test.go
parentaf2aa5e5efa82d3bc7cf5530e0a1eee72ba99244 (diff)
Fix task 25 comic generation leak handling
Diffstat (limited to 'internal/comic/localization_test.go')
-rw-r--r--internal/comic/localization_test.go34
1 files changed, 34 insertions, 0 deletions
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")
+ }
+}