1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00
emacs/test/lisp/vc/ediff-mult-tests.el
Mauro Aranda d01b7c85fe Guard against user saving ediff-meta-diff-buffer
* lisp/vc/ediff-mult.el (ediff-collect-custom-diffs): If the
diff buffer is visiting a file, create a new buffer.  (Bug#3348)

* test/lisp/vc/ediff-mult-tests.el: New test file.
2025-03-09 08:10:17 -03:00

54 lines
1.7 KiB
EmacsLisp

;;; 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")))))