(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestEditFileOldNotFound(t *testing.T) { |
| 46 | dir := t.TempDir() |
| 47 | path := filepath.Join(dir, "f.txt") |
| 48 | if err := os.WriteFile(path, []byte("abc"), 0o644); err != nil { |
| 49 | t.Fatal(err) |
| 50 | } |
| 51 | s := EditFile(path, "missing", "x") |
| 52 | if !strings.Contains(s, "not found") || !strings.Contains(s, path) { |
| 53 | t.Fatalf("bad: %q", s) |
| 54 | } |
| 55 | // File untouched. |
| 56 | got, _ := os.ReadFile(path) |
| 57 | if string(got) != "abc" { |
| 58 | t.Fatalf("file modified on miss: %q", got) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // TestEditFileWhitespaceNearMissHint: a miss whose only difference is |
| 63 | // indentation gets the diagnostic hint, and the file is left untouched (the |
nothing calls this directly
no test coverage detected