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

Function TestMultipatch_Base64Encoding

pkg/coder/engine/multipatch_test.go:203–214  ·  view source on GitHub ↗

TestMultipatch_Base64Encoding exercises the encoding=base64 path so the LLM can ship binary-ish payloads (control chars, non-UTF8) via a single JSON envelope.

(t *testing.T)

Source from the content-addressed store, hash-verified

201// the LLM can ship binary-ish payloads (control chars, non-UTF8) via
202// a single JSON envelope.
203func TestMultipatch_Base64Encoding(t *testing.T) {
204 dir := t.TempDir()
205 path := writeFile(t, dir, "b.txt", "abc\ndef")
206 eng, _, _ := newTestEngine(t, dir)
207
208 // base64("abc\ndef") = "YWJjCmRlZg=="
209 // base64("XYZ\n123") = "WFlaCjEyMw=="
210 editsJSON := `[{"file":"` + path + `","search":"YWJjCmRlZg==","replace":"WFlaCjEyMw==","encoding":"base64"}]`
211 err := eng.Execute(context.Background(), "multipatch", []string{"--edits", editsJSON})
212 require.NoError(t, err)
213 assert.Equal(t, "XYZ\n123", readFile(t, path))
214}
215
216// TestMultipatch_PerFileLockSerializesConcurrentTx is the key
217// concurrency guarantee: two multipatches targeting the same file

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected