summaryrefslogtreecommitdiff
path: root/internal/hexaicli/testhelpers_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/hexaicli/testhelpers_test.go')
-rw-r--r--internal/hexaicli/testhelpers_test.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/hexaicli/testhelpers_test.go b/internal/hexaicli/testhelpers_test.go
index 4cc04f7..16f1639 100644
--- a/internal/hexaicli/testhelpers_test.go
+++ b/internal/hexaicli/testhelpers_test.go
@@ -25,7 +25,9 @@ func setStdin(t *testing.T, content string) (func(), *os.File) {
old := os.Stdin
os.Stdin = f
restore := func() {
- f.Close()
+ if err := f.Close(); err != nil {
+ t.Errorf("failed to close temp stdin file: %v", err)
+ }
os.Stdin = old
}
return restore, f
@@ -71,7 +73,11 @@ func writeTOML(t *testing.T, path string, m map[string]string) {
if err != nil {
t.Fatalf("create: %v", err)
}
- defer f.Close()
+ defer func() {
+ if err := f.Close(); err != nil {
+ t.Errorf("failed to close temp TOML file: %v", err)
+ }
+ }()
for k, v := range m {
if _, err := f.WriteString(k + " = \"" + v + "\"\n"); err != nil {
t.Fatalf("write: %v", err)