MCPcopy Create free account
hub / github.com/compozy/agh / TestWriteTempFileReturnsErrorForClosedFile

Function TestWriteTempFileReturnsErrorForClosedFile

internal/fileutil/atomic_test.go:220–239  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

218}
219
220func TestWriteTempFileReturnsErrorForClosedFile(t *testing.T) {
221 t.Parallel()
222
223 t.Run("Should return error for closed file", func(t *testing.T) {
224 t.Parallel()
225
226 file, err := os.CreateTemp(t.TempDir(), "closed-*")
227 if err != nil {
228 t.Fatalf("CreateTemp() error = %v", err)
229 }
230 path := file.Name()
231 if err := file.Close(); err != nil {
232 t.Fatalf("Close() error = %v", err)
233 }
234
235 if err := writeTempFile(file, path, []byte("content"), 0o644); err == nil {
236 t.Fatal("writeTempFile(closed file) error = nil, want non-nil")
237 }
238 })
239}
240
241func TestSyncDirRejectsMissingDirectory(t *testing.T) {
242 t.Parallel()

Callers

nothing calls this directly

Calls 4

writeTempFileFunction · 0.85
RunMethod · 0.65
NameMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected