TestEditFileWhitespaceNearMissHint: a miss whose only difference is indentation gets the diagnostic hint, and the file is left untouched (the hint is detection only, never a fuzzy apply).
(t *testing.T)
| 63 | // indentation gets the diagnostic hint, and the file is left untouched (the |
| 64 | // hint is detection only, never a fuzzy apply). |
| 65 | func TestEditFileWhitespaceNearMissHint(t *testing.T) { |
| 66 | dir := t.TempDir() |
| 67 | path := filepath.Join(dir, "f.go") |
| 68 | const orig = "func main() {\n\treturn 1\n}\n" // file indents with a tab |
| 69 | if err := os.WriteFile(path, []byte(orig), 0o644); err != nil { |
| 70 | t.Fatal(err) |
| 71 | } |
| 72 | s := EditFile(path, " return 1", " return 2") // model supplied spaces |
| 73 | if !strings.Contains(s, "differs only in whitespace") { |
| 74 | t.Fatalf("want whitespace near-miss hint, got %q", s) |
| 75 | } |
| 76 | if got, _ := os.ReadFile(path); string(got) != orig { |
| 77 | t.Fatalf("file modified on near-miss: %q", got) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func TestEditFileOldNotUnique(t *testing.T) { |
| 82 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected