diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-20 00:02:07 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-20 00:02:07 +0300 |
| commit | a35ca6f40de73e93372ade6f2d74c231389799e2 (patch) | |
| tree | faf7a53d476cbd6d01b694443e8e601cec9257db /internal/comic/localization_test.go | |
| parent | 6130cae3fa396cff94653225e47326b642e270f3 (diff) | |
Fix task 25: keep comic generation single-language and single-style
Diffstat (limited to 'internal/comic/localization_test.go')
| -rw-r--r-- | internal/comic/localization_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
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") + } +} |
