MCPcopy Create free account
hub / github.com/diillson/chatcli / TestMultipatch_HappyPathSingleFile

Function TestMultipatch_HappyPathSingleFile

pkg/coder/engine/multipatch_test.go:52–63  ·  view source on GitHub ↗

TestMultipatch_HappyPathSingleFile is the smoke test: one edit against one file lands cleanly. Mirrors handlePatch but goes through the new transactional code path.

(t *testing.T)

Source from the content-addressed store, hash-verified

50// against one file lands cleanly. Mirrors handlePatch but goes
51// through the new transactional code path.
52func TestMultipatch_HappyPathSingleFile(t *testing.T) {
53 dir := t.TempDir()
54 path := writeFile(t, dir, "a.txt", "hello world\n")
55 eng, out, _ := newTestEngine(t, dir)
56
57 editsJSON := `[{"file":"` + path + `","search":"hello","replace":"goodbye"}]`
58 err := eng.Execute(context.Background(), "multipatch", []string{"--edits", editsJSON})
59 require.NoError(t, err)
60 assert.Equal(t, "goodbye world\n", readFile(t, path))
61 assert.Contains(t, out.String(), "multipatch")
62 assert.Contains(t, out.String(), "applied 1 edit")
63}
64
65// TestMultipatch_HappyPathMultipleFiles confirms cross-file atomic
66// commit: three files, three edits, all land in one transaction.

Callers

nothing calls this directly

Calls 6

newTestEngineFunction · 0.85
EqualMethod · 0.80
writeFileFunction · 0.70
readFileFunction · 0.70
ExecuteMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected