master 5f2ab083f18 1/2: Test for bug#81504

Sean Whitton <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit 5f2ab083f180c3f70e2a36d6ef5eb2df9413a152
Author: Donjuanplatinum <[email protected]>
Commit: Sean Whitton <[email protected]>

    Test for bug#81504
    
    * test/src/buffer-tests.el
    (test-make-indirect-buffer-clone-hook): New test.
---
 test/src/buffer-tests.el | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el
index 3fae18011fb..ba7a683c365 100644
--- a/test/src/buffer-tests.el
+++ b/test/src/buffer-tests.el
@@ -1477,7 +1477,22 @@ Test both rear-advance and non-rear-advance overlays."
         (when (buffer-live-p indirect)
           (kill-buffer indirect))))))
 
-
+(ert-deftest test-make-indirect-buffer-clone-hook ()
+  (let ((base-buf (generate-new-buffer "base")))
+    (unwind-protect
+        (progn
+          (with-current-buffer base-buf
+            (insert "sample text"))
+          (set-buffer base-buf)
+          (let ((clone-indirect-buffer-hook
+                 (list (lambda ()
+                         (error "clone hook error")))))
+            (should-error
+             (make-indirect-buffer base-buf "indirect" t)))
+          (should (eq (current-buffer) base-buf)))
+      (ignore-errors (kill-buffer "indirect"))
+      (when (buffer-live-p base-buf)
+        (kill-buffer base-buf)))))
 
 ;; +==========================================================================+
 ;; | buffer-swap-text
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.