MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestEditFileOldNotFound

Function TestEditFileOldNotFound

internal/tools/edit_test.go:45–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func 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

Callers

nothing calls this directly

Calls 1

EditFileFunction · 0.85

Tested by

no test coverage detected