diff-hl-adjust-test.el
1 ;;; diff-hl-adjust-test.el -*- lexical-binding: t -*- 2 3 ;; Copyright (C) 2025 Free Software Foundation, Inc. 4 5 ;; This file is part of GNU Emacs. 6 7 ;; GNU Emacs is free software: you can redistribute it and/or modify 8 ;; it under the terms of the GNU General Public License as published by 9 ;; the Free Software Foundation, either version 3 of the License, or 10 ;; (at your option) any later version. 11 12 ;; GNU Emacs is distributed in the hope that it will be useful, 13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 ;; GNU General Public License for more details. 16 17 ;; You should have received a copy of the GNU General Public License 18 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 19 20 ;;; Commentary: 21 22 ;;; Code: 23 24 (require 'diff-hl) 25 (require 'ert) 26 27 (ert-deftest diff-hl-adjust-no-intersection () 28 (should 29 (equal 30 (diff-hl-adjust-changes 31 (copy-tree '((1 2 0) (5 3 0))) 32 (list '(3 4 2) '(11 3 0))) 33 '((1 2 0) (7 3 0))))) 34 35 (ert-deftest diff-hl-adjust-overlap-front () 36 (should 37 (equal 38 (diff-hl-adjust-changes 39 (copy-tree '((1 2 0) (5 3 0) (11 0 2))) 40 (list '(3 6 4))) 41 '((1 2 0) (9 1 0) (13 0 2))))) 42 43 (ert-deftest diff-hl-adjust-overlap-back () 44 (should 45 (equal 46 (diff-hl-adjust-changes 47 (copy-tree '((1 2 0) (11 0 2))) 48 (list '(2 6 4))) 49 '((1 4 0) (13 0 2))))) 50 51 (ert-deftest diff-hl-adjust-overlap-multiple () 52 (should 53 (equal 54 (diff-hl-adjust-changes 55 (copy-tree '((1 2 0) (4 3 2))) 56 (list '(2 6 4))) 57 '((1 4 0) (8 1 2))))) 58 59 (ert-deftest diff-hl-adjust-multiple-new () 60 (should 61 (equal 62 (diff-hl-adjust-changes 63 (copy-tree '((1 2 0) (5 3 0))) 64 (list '(2 1 0) '(4 2 1))) 65 '((1 3 0) (7 3 0))))) 66 67 (provide 'diff-hl-adjust-test) 68 69 ;;; diff-hl-adjust-test.el ends here