aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/buffer-tests.el
diff options
context:
space:
mode:
authorMatt Armstrong2022-11-01 19:40:20 -0700
committerStefan Monnier2022-11-05 16:48:55 -0400
commit5c9895fffe4e34b7a31b0a8e4bce0b59a4bc0326 (patch)
tree422aa160729ba1b6682c44abb93408db34c891ef /test/src/buffer-tests.el
parent26d2ac38e9a7486aa56acb6bb0162c8ee091aaca (diff)
downloademacs-5c9895fffe4e34b7a31b0a8e4bce0b59a4bc0326.tar.gz
emacs-5c9895fffe4e34b7a31b0a8e4bce0b59a4bc0326.zip
Add a test for overlay evaporation across indirect buffers
* test/src/buffer-tests.el (buffer-tests--overlays-indirect-evaporate): Test evaporation of overlays triggered by deleting text in base and in indirect buffers. Test doesn't pass at the moment.
Diffstat (limited to 'test/src/buffer-tests.el')
-rw-r--r--test/src/buffer-tests.el36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el
index 0e9e84ef7a1..3c371760952 100644
--- a/test/src/buffer-tests.el
+++ b/test/src/buffer-tests.el
@@ -296,6 +296,42 @@ with parameters from the *Messages* buffer modification."
296 (should (equal (overlay-start ol1) (overlay-start ol2))) 296 (should (equal (overlay-start ol1) (overlay-start ol2)))
297 (should (equal (overlay-end ol1) (overlay-end ol2)))))) 297 (should (equal (overlay-end ol1) (overlay-end ol2))))))
298 298
299(ert-deftest buffer-tests--overlays-indirect-evaporate ()
300 "Verify that deleting text evaporates overlays in every related buffer.
301
302Deleting characters from either a base or an indirect buffer
303should evaporate overlays in both."
304 :expected-result :failed
305 ;; Loop twice, erasing from the base buffer the first time and the
306 ;; indirect buffer the second.
307 (dolist (erase-where '(base indirect))
308 (ert-info ((format "erase-where %S" erase-where))
309 (with-temp-buffer
310 (insert "xxx")
311 (let* ((beg 2)
312 (end 3)
313 (base (current-buffer))
314 (base-overlay (make-overlay beg end base))
315 (indirect (make-indirect-buffer
316 base
317 (generate-new-buffer-name
318 (concat (buffer-name base) "-indirect"))))
319 (indirect-overlay (make-overlay beg end indirect)))
320 (overlay-put base-overlay 'evaporate t)
321 (overlay-put indirect-overlay 'evaporate t)
322 (with-current-buffer (pcase-exhaustive erase-where
323 (`base base)
324 (`indirect indirect))
325 (delete-region beg end))
326 (ert-info ((prin1-to-string
327 `(,base ,base-overlay ,indirect ,indirect-overlay)))
328 (should (not (buffer-live-p (overlay-buffer base-overlay))))
329 (should (not (buffer-live-p (overlay-buffer indirect-overlay))))
330 (should (equal nil (with-current-buffer base
331 (overlays-in (point-min) (point-max)))))
332 (should (equal nil (with-current-buffer indirect
333 (overlays-in (point-min) (point-max)))))))))))
334
299(ert-deftest overlay-evaporation-after-killed-buffer () 335(ert-deftest overlay-evaporation-after-killed-buffer ()
300 (let* ((ols (with-temp-buffer 336 (let* ((ols (with-temp-buffer
301 (insert "toto") 337 (insert "toto")