From d94fdaf92d7c66c012e819c73632be16f346b66f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 2 Apr 2026 21:54:05 +0300 Subject: 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 --- internal/image/prompt_test.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/image') 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) -- cgit v1.2.3