summaryrefslogtreecommitdiff
path: root/test/lisp/vc/ediff-mult-tests.el
blob: 525088bf856713806c1f7f902bc7b8f9538cd89d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
;;; ediff-mult-tests.el --- Tests for ediff-mult.el  -*- lexical-binding:t -*-

;; Copyright (C) 2025 Free Software Foundation, Inc.

;; This file is part of GNU Emacs.
;;
;; GNU Emacs is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Code:

(require 'ert)
(require 'ediff-mult)

(ert-deftest ediff-test-bug3348 ()
  "After saving `ediff-meta-diff-buffer' to a file, we should not reuse it."
  (let ((test-dir
         (expand-file-name "bug-3348-testdir" temporary-file-directory)))
    (make-directory test-dir t)
    (cd test-dir)

    (make-directory "dir-a" t)
    (make-directory "dir-b" t)

    (with-temp-file "dir-a/file"
      (insert "aaa\n"))
    (with-temp-file "dir-b/file"
      (insert "bbb\n"))

    (ediff-directories "dir-a" "dir-b" nil)
    (switch-to-buffer "*Ediff Session Group Panel*")

    (ediff-next-meta-item 1)
    (ediff-mark-for-operation-at-pos nil)
    (ediff-collect-custom-diffs)

    (with-current-buffer "*Ediff Multifile Diffs*"
      (write-file "foo.patch"))

    (with-temp-file "dir-b/file"
      (insert "BBB\n"))
    (ediff-collect-custom-diffs)

    (should-not (equal ediff-meta-diff-buffer (get-buffer "foo.patch")))))