MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestWriteFileCreatesParentDirs

Function TestWriteFileCreatesParentDirs

internal/tools/write_test.go:30–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestWriteFileCreatesParentDirs(t *testing.T) {
31 dir := t.TempDir()
32 path := filepath.Join(dir, "nested", "deep", "file.txt")
33 s := WriteFile(path, "x")
34 if !strings.Contains(s, "wrote 1 bytes") {
35 t.Fatalf("status wrong: %q", s)
36 }
37 if _, err := os.Stat(path); err != nil {
38 t.Fatalf("file not created: %v", err)
39 }
40}
41
42func TestWriteFileEmptyPath(t *testing.T) {
43 if WriteFile("", "x") != "(empty path)" {

Callers

nothing calls this directly

Calls 1

WriteFileFunction · 0.85

Tested by

no test coverage detected