MCPcopy Create free account
hub / github.com/sergi/go-diff / TestDiffCleanupSemanticLossless

Function TestDiffCleanupSemanticLossless

diffmatchpatch/diff_test.go:478–614  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

476}
477
478func TestDiffCleanupSemanticLossless(t *testing.T) {
479 type TestCase struct {
480 Name string
481
482 Diffs []Diff
483
484 Expected []Diff
485 }
486
487 dmp := New()
488
489 for i, tc := range []TestCase{
490 {
491 "Null case",
492 []Diff{},
493 []Diff{},
494 },
495 {
496 "Blank lines",
497 []Diff{
498 Diff{DiffEqual, "AAA\r\n\r\nBBB"},
499 Diff{DiffInsert, "\r\nDDD\r\n\r\nBBB"},
500 Diff{DiffEqual, "\r\nEEE"},
501 },
502 []Diff{
503 Diff{DiffEqual, "AAA\r\n\r\n"},
504 Diff{DiffInsert, "BBB\r\nDDD\r\n\r\n"},
505 Diff{DiffEqual, "BBB\r\nEEE"},
506 },
507 },
508 {
509 "Line boundaries",
510 []Diff{
511 Diff{DiffEqual, "AAA\r\nBBB"},
512 Diff{DiffInsert, " DDD\r\nBBB"},
513 Diff{DiffEqual, " EEE"},
514 },
515 []Diff{
516 Diff{DiffEqual, "AAA\r\n"},
517 Diff{DiffInsert, "BBB DDD\r\n"},
518 Diff{DiffEqual, "BBB EEE"},
519 },
520 },
521 {
522 "Word boundaries",
523 []Diff{
524 Diff{DiffEqual, "The c"},
525 Diff{DiffInsert, "ow and the c"},
526 Diff{DiffEqual, "at."},
527 },
528 []Diff{
529 Diff{DiffEqual, "The "},
530 Diff{DiffInsert, "cow and the "},
531 Diff{DiffEqual, "cat."},
532 },
533 },
534 {
535 "Alphanumeric boundaries",

Callers

nothing calls this directly

Calls 2

NewFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…