]> git.giacomolli.uk - onechat/blobdiff - voice_transcriber_test.go
Separate multiline Go statements
[onechat] / voice_transcriber_test.go
index 48732f7a76691c468450223d089a87f98f728b3d..c04d091aab39ea70239dc2f13321d3304e22027e 100644 (file)
@@ -29,6 +29,7 @@ printf '  A made-up voice transcript.\n' > "$output.txt"
 printf 'private speech in process output'
 printf 'private speech in process errors' >&2
 `)
 printf 'private speech in process output'
 printf 'private speech in process errors' >&2
 `)
+
        data := []byte("made-up audio")
        text := transcriber.Text(t.Context(), store, data)
        require.Contains(t, text, "[voice ")
        data := []byte("made-up audio")
        text := transcriber.Text(t.Context(), store, data)
        require.Contains(t, text, "[voice ")
@@ -57,10 +58,20 @@ func TestVoiceFailuresKeepStoredAudioAndSafeMarkers(t *testing.T) {
                name   string
                script string
        }{
                name   string
                script string
        }{
-               {name: "failed process does not expose its errors", script: "echo secret-speech >&2; exit 1"},
-               {name: "missing transcript gets a marker", script: "exit 0"},
-               {name: "empty transcript gets a marker", script: "while [ \"$1\" != --output-file ]; do shift; done; shift; touch \"$1.txt\""},
+               {
+                       name:   "failed process does not expose its errors",
+                       script: "echo secret-speech >&2; exit 1",
+               },
+               {
+                       name:   "missing transcript gets a marker",
+                       script: "exit 0",
+               },
+               {
+                       name:   "empty transcript gets a marker",
+                       script: "while [ \"$1\" != --output-file ]; do shift; done; shift; touch \"$1.txt\"",
+               },
        }
        }
+
        for _, tc := range testCases {
                t.Run(tc.name, func(t *testing.T) {
                        store, transcriber := voiceTestInput(t, tc.script)
        for _, tc := range testCases {
                t.Run(tc.name, func(t *testing.T) {
                        store, transcriber := voiceTestInput(t, tc.script)
@@ -144,7 +155,10 @@ func TestVoiceConfigReadsExplicitLocalPaths(t *testing.T) {
 
        config, err := loadConfig(dir)
        require.NoError(t, err)
 
        config, err := loadConfig(dir)
        require.NoError(t, err)
-       require.Equal(t, VoiceConfig{Transcriber: "local-whisper", Model: "model.bin"}, config.Voice)
+       require.Equal(t, VoiceConfig{
+               Transcriber: "local-whisper",
+               Model:       "model.bin",
+       }, config.Voice)
 }
 
 func TestVoiceLookupHonorsExplicitThenNixThenPath(t *testing.T) {
 }
 
 func TestVoiceLookupHonorsExplicitThenNixThenPath(t *testing.T) {
@@ -178,8 +192,11 @@ func TestVoiceLookupHonorsExplicitThenNixThenPath(t *testing.T) {
                        available: true,
                },
                {
                        available: true,
                },
                {
-                       name:    "invalid explicit executable does not fall back",
-                       config:  VoiceConfig{Transcriber: "missing", Model: valid.Model},
+                       name: "invalid explicit executable does not fall back",
+                       config: VoiceConfig{
+                               Transcriber: "missing",
+                               Model:       valid.Model,
+                       },
                        program: valid.Transcriber,
                },
                {
                        program: valid.Transcriber,
                },
                {
@@ -193,6 +210,7 @@ func TestVoiceLookupHonorsExplicitThenNixThenPath(t *testing.T) {
                        program: valid.Transcriber,
                },
        }
                        program: valid.Transcriber,
                },
        }
+
        for _, tc := range testCases {
                t.Run(tc.name, func(t *testing.T) {
                        program, model, err := voiceLookup(tc.config, tc.program, tc.model)
        for _, tc := range testCases {
                t.Run(tc.name, func(t *testing.T) {
                        program, model, err := voiceLookup(tc.config, tc.program, tc.model)