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

Function TestEditFileEmptyOldString

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

Source from the content-addressed store, hash-verified

126}
127
128func TestEditFileEmptyOldString(t *testing.T) {
129 dir := t.TempDir()
130 path := filepath.Join(dir, "f.txt")
131 if err := os.WriteFile(path, []byte("abc"), 0o644); err != nil {
132 t.Fatal(err)
133 }
134 s := EditFile(path, "", "x")
135 if !strings.Contains(s, "empty") {
136 t.Fatalf("bad: %q", s)
137 }
138 got, _ := os.ReadFile(path)
139 if string(got) != "abc" {
140 t.Fatalf("file modified on empty old_string: %q", got)
141 }
142}
143
144func TestEditFileDelete(t *testing.T) {
145 dir := t.TempDir()

Callers

nothing calls this directly

Calls 1

EditFileFunction · 0.85

Tested by

no test coverage detected