(t *testing.T)
| 476 | } |
| 477 | |
| 478 | func 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", |
nothing calls this directly
no test coverage detected
searching dependent graphs…