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

Function TestOmitFilenames

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

Source from the content-addressed store, hash-verified

368}
369
370func TestOmitFilenames(t *testing.T) {
371 diff := LineDiffParams{
372 A: SplitLines("o\nn\ne\n"),
373 B: SplitLines("t\nw\no\n"),
374 Eol: "\n",
375 }
376 ud, err := GetUnifiedDiffString(diff)
377 assertEqual(t, err, nil)
378 assertEqual(t, SplitLines(ud), []string{
379 "@@ -0,0 +1,2 @@\n",
380 "+t\n",
381 "+w\n",
382 "@@ -2,2 +3,0 @@\n",
383 "-n\n",
384 "-e\n",
385 "\n",
386 })
387
388 cd, err := GetContextDiffString(ContextDiff(diff))
389 assertEqual(t, err, nil)
390 assertEqual(t, SplitLines(cd), []string{
391 "***************\n",
392 "*** 0 ****\n",
393 "--- 1,2 ----\n",
394 "+ t\n",
395 "+ w\n",
396 "***************\n",
397 "*** 2,3 ****\n",
398 "- n\n",
399 "- e\n",
400 "--- 3 ----\n",
401 "\n",
402 })
403}
404
405func TestSplitLines(t *testing.T) {
406 allTests := []struct {

Callers

nothing calls this directly

Calls 5

ContextDiffTypeAlias · 0.85
SplitLinesFunction · 0.70
GetUnifiedDiffStringFunction · 0.70
assertEqualFunction · 0.70
GetContextDiffStringFunction · 0.70

Tested by

no test coverage detected