MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestEditFileDelete

Function TestEditFileDelete

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

Source from the content-addressed store, hash-verified

142}
143
144func 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
160func TestEditFileMultilineOldString(t *testing.T) {
161 dir := t.TempDir()

Callers

nothing calls this directly

Calls 1

EditFileFunction · 0.85

Tested by

no test coverage detected