diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/vc/diff-mode-tests.el | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el index 19e3dbb42a6..b67ccd4fe09 100644 --- a/test/lisp/vc/diff-mode-tests.el +++ b/test/lisp/vc/diff-mode-tests.el | |||
| @@ -478,5 +478,84 @@ baz")))) | |||
| 478 | (should (equal (diff-hunk-file-names) | 478 | (should (equal (diff-hunk-file-names) |
| 479 | '("/tmp/ange-ftp1351895K.el" "/tmp/ange-ftp13518wvE.el"))))) | 479 | '("/tmp/ange-ftp1351895K.el" "/tmp/ange-ftp13518wvE.el"))))) |
| 480 | 480 | ||
| 481 | (ert-deftest diff-mode-test-fixups-added-lines () | ||
| 482 | "Check that `diff-fixup-modifs' works well with hunks with added lines." | ||
| 483 | (let ((patch "--- file | ||
| 484 | +++ file | ||
| 485 | @@ -0,0 +1,15 @@ | ||
| 486 | +1 | ||
| 487 | +2 | ||
| 488 | +3 | ||
| 489 | +4 | ||
| 490 | ")) | ||
| 491 | (with-temp-buffer | ||
| 492 | (insert patch) | ||
| 493 | (diff-fixup-modifs (point-min) (point-max)) | ||
| 494 | (should (equal (buffer-string) "--- file | ||
| 495 | +++ file | ||
| 496 | @@ -0,0 +1,4 @@ | ||
| 497 | +1 | ||
| 498 | +2 | ||
| 499 | +3 | ||
| 500 | +4 | ||
| 501 | ")))) | ||
| 502 | (let ((patch "--- file | ||
| 503 | +++ file | ||
| 504 | @@ -389,5 +398,6 @@ | ||
| 505 | while (1) | ||
| 506 | ; | ||
| 507 | + # not needed | ||
| 508 | # at all | ||
| 509 | # stop | ||
| 510 | ")) | ||
| 511 | (with-temp-buffer | ||
| 512 | (insert patch) | ||
| 513 | (diff-fixup-modifs (point-min) (point-max)) | ||
| 514 | (should (equal (buffer-string) "--- file | ||
| 515 | +++ file | ||
| 516 | @@ -389,4 +398,5 @@ | ||
| 517 | while (1) | ||
| 518 | ; | ||
| 519 | + # not needed | ||
| 520 | # at all | ||
| 521 | # stop | ||
| 522 | "))))) | ||
| 523 | |||
| 524 | (ert-deftest diff-mode-test-fixups-empty-hunks () | ||
| 525 | "Check that `diff-fixup-modifs' works well with empty hunks." | ||
| 526 | (let ((patch "--- file | ||
| 527 | +++ file | ||
| 528 | @@ -1 +1 @@ | ||
| 529 | -1 | ||
| 530 | @@ -10 +10 @@ | ||
| 531 | -1 | ||
| 532 | +1 | ||
| 533 | --- otherfile | ||
| 534 | +++ otherfile | ||
| 535 | @@ -1 +1 @@ | ||
| 536 | +2 | ||
| 537 | @@ -10 +10 @@ | ||
| 538 | -1 | ||
| 539 | +1 | ||
| 540 | ")) | ||
| 541 | (with-temp-buffer | ||
| 542 | (insert patch) | ||
| 543 | (diff-fixup-modifs (point-min) (point-max)) | ||
| 544 | (should (equal (buffer-string) "--- file | ||
| 545 | +++ file | ||
| 546 | @@ -1,1 +1,0 @@ | ||
| 547 | -1 | ||
| 548 | @@ -10,1 +10,1 @@ | ||
| 549 | -1 | ||
| 550 | +1 | ||
| 551 | --- otherfile | ||
| 552 | +++ otherfile | ||
| 553 | @@ -1,0 +1,1 @@ | ||
| 554 | +2 | ||
| 555 | @@ -10,1 +10,1 @@ | ||
| 556 | -1 | ||
| 557 | +1 | ||
| 558 | "))))) | ||
| 559 | |||
| 481 | (provide 'diff-mode-tests) | 560 | (provide 'diff-mode-tests) |
| 482 | ;;; diff-mode-tests.el ends here | 561 | ;;; diff-mode-tests.el ends here |