(t *testing.T)
| 142 | } |
| 143 | |
| 144 | func TestEditFileDelete(t *testing.T) { |
| 145 | dir := t.TempDir() |
| 146 | path := filepath.Join(dir, "f.txt") |
| 147 | if err := os.WriteFile(path, []byte("alpha beta gamma"), 0o644); err != nil { |
| 148 | t.Fatal(err) |
| 149 | } |
| 150 | s := EditFile(path, "beta ", "") |
| 151 | if !strings.HasPrefix(s, "edited") { |
| 152 | t.Fatalf("bad: %q", s) |
| 153 | } |
| 154 | got, _ := os.ReadFile(path) |
| 155 | if string(got) != "alpha gamma" { |
| 156 | t.Fatalf("content wrong: %q", got) |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | func TestEditFileMultilineOldString(t *testing.T) { |
| 161 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected