From a35ca6f40de73e93372ade6f2d74c231389799e2 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 20 Apr 2026 00:02:07 +0300 Subject: Fix task 25: keep comic generation single-language and single-style --- internal/comic/localization_test.go | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 internal/comic/localization_test.go (limited to 'internal/comic/localization_test.go') diff --git a/internal/comic/localization_test.go b/internal/comic/localization_test.go new file mode 100644 index 0000000..a1609f3 --- /dev/null +++ b/internal/comic/localization_test.go @@ -0,0 +1,42 @@ +package comic + +import "testing" + +func TestLocalizedBrandName(t *testing.T) { + t.Parallel() + + if got, want := localizedBrandName("Bulgarian", "Cyrillic"), "КомиксФордж Приключения"; got != want { + t.Fatalf("localizedBrandName() = %q, want %q", got, want) + } + if got, want := localizedBrandName("English", "Latin"), "ComicForge Adventures"; got != want { + t.Fatalf("localizedBrandName() = %q, want %q", got, want) + } +} + +func TestValidateTextScript(t *testing.T) { + t.Parallel() + + if err := validateTextScript("title", "Заглавие", "Cyrillic"); err != nil { + t.Fatalf("validateTextScript() error = %v", err) + } + if err := validateTextScript("title", "Title", "Cyrillic"); err == nil { + t.Fatal("validateTextScript() error = nil, want Latin rejection") + } + if err := validateTextScript("title", "Title", "Latin"); err != nil { + t.Fatalf("validateTextScript() error = %v", err) + } + if err := validateTextScript("title", "Заглавие", "Latin"); err == nil { + t.Fatal("validateTextScript() error = nil, want Cyrillic rejection") + } +} + +func TestValidateNoPromptLeakage(t *testing.T) { + t.Parallel() + + if err := validateNoPromptLeakage("story", "A calm story without artifacts."); err != nil { + t.Fatalf("validateNoPromptLeakage() error = %v", err) + } + if err := validateNoPromptLeakage("story", "Words to include:\n- ябълка"); err == nil { + t.Fatal("validateNoPromptLeakage() error = nil, want prompt leakage rejection") + } +} -- cgit v1.2.3