summaryrefslogtreecommitdiff
path: root/internal/hexaicli/testhelpers_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-06 11:14:27 +0300
committerPaul Buetow <paul@buetow.org>2025-09-06 11:14:27 +0300
commitfb267966f7840df222338f57023273a993a73c9a (patch)
treed10066412f08b386a6f9fe9289f27124c6ebe9d6 /internal/hexaicli/testhelpers_test.go
parent1bf4251a7edbd00902f22db77031d0f998569614 (diff)
use TOML not JSON for configuration
Diffstat (limited to 'internal/hexaicli/testhelpers_test.go')
-rw-r--r--internal/hexaicli/testhelpers_test.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/internal/hexaicli/testhelpers_test.go b/internal/hexaicli/testhelpers_test.go
index 512a3ba..93f1e3d 100644
--- a/internal/hexaicli/testhelpers_test.go
+++ b/internal/hexaicli/testhelpers_test.go
@@ -3,7 +3,6 @@ package hexaicli
import (
"context"
- "encoding/json"
"os"
"path/filepath"
"testing"
@@ -62,8 +61,8 @@ func (s *fakeStreamer) ChatStream(ctx context.Context, messages []llm.Message, o
return nil
}
-// small JSON writer for tests
-func writeJSON(t *testing.T, path string, v any) {
+// small TOML writer for tests (string values only)
+func writeTOML(t *testing.T, path string, m map[string]string) {
t.Helper()
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
t.Fatalf("mkdir: %v", err)
@@ -73,8 +72,10 @@ func writeJSON(t *testing.T, path string, v any) {
t.Fatalf("create: %v", err)
}
defer f.Close()
- if err := json.NewEncoder(f).Encode(v); err != nil {
- t.Fatalf("encode: %v", err)
+ for k, v := range m {
+ if _, err := f.WriteString(k + " = \"" + v + "\"\n"); err != nil {
+ t.Fatalf("write: %v", err)
+ }
}
}