MCPcopy Create free account
hub / github.com/cogentcore/core / TestGetUnifiedDiffString

Function TestGetUnifiedDiffString

texteditor/difflib/difflib_test.go:600–617  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

598}
599
600func TestGetUnifiedDiffString(t *testing.T) {
601 A := "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n"
602 B := "one\ntwo\nthr33\nfour\nfive\nsix\nseven\neight\nnine\nten\n"
603 // Build diff
604 diff := LineDiffParams{A: SplitLines(A),
605 FromFile: "file", FromDate: "then",
606 B: SplitLines(B),
607 ToFile: "tile", ToDate: "now", Eol: "", Context: 1}
608 // Run test
609 diffStr, err := GetUnifiedDiffString(diff)
610 if err != nil {
611 t.Fatal("GetUnifiedDiffString error:", err)
612 }
613 exp := "--- file\tthen\n+++ tile\tnow\n@@ -2,3 +2,3 @@\n two\n-three\n+thr33\n four\n"
614 if diffStr != exp {
615 t.Fatal("GetUnifiedDiffString failure:", diffStr)
616 }
617}

Callers

nothing calls this directly

Calls 2

SplitLinesFunction · 0.70
GetUnifiedDiffStringFunction · 0.70

Tested by

no test coverage detected