(t *testing.T)
| 28 | } |
| 29 | |
| 30 | func 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 | |
| 42 | func TestWriteFileEmptyPath(t *testing.T) { |
| 43 | if WriteFile("", "x") != "(empty path)" { |
nothing calls this directly
no test coverage detected