(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestWriteFileHappy(t *testing.T) { |
| 14 | dir := t.TempDir() |
| 15 | path := filepath.Join(dir, "hello.txt") |
| 16 | content := "line one\nline two with 'quotes' and $dollar and `backticks`\n" |
| 17 | s := WriteFile(path, content) |
| 18 | if !strings.Contains(s, "wrote") || !strings.Contains(s, "hello.txt") { |
| 19 | t.Fatalf("status wrong: %q", s) |
| 20 | } |
| 21 | got, err := os.ReadFile(path) |
| 22 | if err != nil { |
| 23 | t.Fatalf("readback: %v", err) |
| 24 | } |
| 25 | if string(got) != content { |
| 26 | t.Fatalf("content mismatch: %q", got) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func TestWriteFileCreatesParentDirs(t *testing.T) { |
| 31 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected