diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-06 11:14:27 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-06 11:14:27 +0300 |
| commit | fb267966f7840df222338f57023273a993a73c9a (patch) | |
| tree | d10066412f08b386a6f9fe9289f27124c6ebe9d6 /internal/hexaicli/testhelpers_test.go | |
| parent | 1bf4251a7edbd00902f22db77031d0f998569614 (diff) | |
use TOML not JSON for configuration
Diffstat (limited to 'internal/hexaicli/testhelpers_test.go')
| -rw-r--r-- | internal/hexaicli/testhelpers_test.go | 11 |
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) + } } } |
