MCPcopy Create free account
hub / github.com/JanSmrcka/differ / TestParseDiff_Truncation

Function TestParseDiff_Truncation

internal/ui/diff_test.go:372–390  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

370}
371
372func TestParseDiff_Truncation(t *testing.T) {
373 t.Parallel()
374 // Build a diff that exceeds maxDiffLines
375 var b strings.Builder
376 b.WriteString("@@ -1,20000 +1,20000 @@\n")
377 for range maxDiffLines + 10 {
378 b.WriteString("+line\n")
379 }
380 parsed := ParseDiff(b.String())
381 // Should be capped at maxDiffLines+1 (the truncation marker)
382 if len(parsed.Lines) > maxDiffLines+2 {
383 t.Errorf("expected truncation, got %d lines", len(parsed.Lines))
384 }
385 // Last line should be the truncation marker
386 last := parsed.Lines[len(parsed.Lines)-1]
387 if last.Type != LineHunkHeader || !strings.Contains(last.Content, "truncated") {
388 t.Errorf("expected truncation marker, got %+v", last)
389 }
390}
391
392// --- Render functions ---
393

Callers

nothing calls this directly

Calls 1

ParseDiffFunction · 0.85

Tested by

no test coverage detected