summaryrefslogtreecommitdiff
path: root/internal/image
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-02 21:54:05 +0300
committerPaul Buetow <paul@buetow.org>2026-04-02 21:54:05 +0300
commitd94fdaf92d7c66c012e819c73632be16f346b66f (patch)
treec8e39c8c81ecceb589722ab7179ce2e1f82bbba2 /internal/image
parent29f634d3413924af3a9dd6f89983c29b5320fe66 (diff)
task 00p: add -race to default test task; add t.Parallel() to safe unit tests
- Enable -race flag on the default 'task test' command so race conditions are caught by default, not only when running 'task test-race' - Add t.Parallel() to all tests in internal/image/prompt_test.go (pure function tests with no shared state) - Add t.Parallel() to TestReadBatchFile and its subtests in batch package (file I/O with t.TempDir(), no global state) - Add t.Parallel() to TestValidateBulgarianText and its subtests in audio package (pure string validation, no shared state) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/image')
-rw-r--r--internal/image/prompt_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/image/prompt_test.go b/internal/image/prompt_test.go
index 1961ce2..41172e3 100644
--- a/internal/image/prompt_test.go
+++ b/internal/image/prompt_test.go
@@ -6,18 +6,21 @@ import (
)
func TestPromptSubjectUsesTranslationFirst(t *testing.T) {
+ t.Parallel()
if got := promptSubject(" apple ", "ябълка"); got != "apple" {
t.Fatalf("promptSubject() = %q, want %q", got, "apple")
}
}
func TestPromptSubjectFallsBackToOriginalWord(t *testing.T) {
+ t.Parallel()
if got := promptSubject(" ", "ябълка"); got != "ябълка" {
t.Fatalf("promptSubject() = %q, want %q", got, "ябълка")
}
}
func TestSanitizeSceneDescriptionRemovesLabelsAndFences(t *testing.T) {
+ t.Parallel()
scene := "```text\nScene: A bright apple sits centered on a wooden table.\n```"
if got := sanitizeSceneDescription(scene); got != "A bright apple sits centered on a wooden table" {
t.Fatalf("sanitizeSceneDescription() = %q", got)
@@ -25,6 +28,7 @@ func TestSanitizeSceneDescriptionRemovesLabelsAndFences(t *testing.T) {
}
func TestUsableSceneDescriptionRejectsTrivialContent(t *testing.T) {
+ t.Parallel()
if usableSceneDescription("A") {
t.Fatal("usableSceneDescription() unexpectedly accepted trivial scene")
}
@@ -34,6 +38,7 @@ func TestUsableSceneDescriptionRejectsTrivialContent(t *testing.T) {
}
func TestFallbackVisualDirectionForPhrase(t *testing.T) {
+ t.Parallel()
got := fallbackVisualDirection("to indulge someone")
if got == "" || !usableSceneDescription(got) {
t.Fatalf("fallbackVisualDirection() returned unusable phrase direction: %q", got)
@@ -41,6 +46,7 @@ func TestFallbackVisualDirectionForPhrase(t *testing.T) {
}
func TestFallbackVisualDirectionForSingleWord(t *testing.T) {
+ t.Parallel()
got := fallbackVisualDirection("apple")
if got == "" || !strings.Contains(got, "single apple") {
t.Fatalf("fallbackVisualDirection() = %q", got)