package main import ( "os" "os/exec" "path/filepath" "testing" "github.com/stretchr/testify/require" ) func voiceTestInput(t *testing.T, script string) (*VoiceStore, *VoiceTranscriber) { t.Helper() dir := t.TempDir() program := filepath.Join(dir, "whisper-cli") shell, err := exec.LookPath("sh") require.NoError(t, err) require.NoError(t, os.WriteFile(program, []byte("#!"+shell+"\nset -eu\n"+script+"\n"), 0o700)) model := filepath.Join(dir, "model.bin") require.NoError(t, os.WriteFile(model, []byte("made-up model"), 0o600)) return &VoiceStore{dir: filepath.Join(dir, voiceDirName)}, &VoiceTranscriber{config: VoiceConfig{ Transcriber: program, Model: model, }} }