aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/buffer-tests.el
diff options
context:
space:
mode:
authorEli Zaretskii2025-11-16 11:07:32 +0200
committerEli Zaretskii2025-11-16 11:08:11 +0200
commit858d54d51d73dbf9bc8bd90b2b9acf6313f413b4 (patch)
tree143ec362405ec4d109169b52e09966ad44acb74f /test/src/buffer-tests.el
parent50c30a924086460c1723c5830a4cf6a89e0a9c2a (diff)
downloademacs-858d54d51d73dbf9bc8bd90b2b9acf6313f413b4.tar.gz
emacs-858d54d51d73dbf9bc8bd90b2b9acf6313f413b4.zip
; Fix cleanup in buffer-tests
* test/src/buffer-tests.el (test-restore-buffer-modified-p) (test-buffer-chars-modified-ticks): Don't leave unsaved and modified file buffers after the tests.
Diffstat (limited to 'test/src/buffer-tests.el')
-rw-r--r--test/src/buffer-tests.el16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el
index 0879b928565..2349e63ac33 100644
--- a/test/src/buffer-tests.el
+++ b/test/src/buffer-tests.el
@@ -8507,7 +8507,10 @@ Finally, kill the buffer and its temporary file."
8507 8507
8508 ;; Clean up. 8508 ;; Clean up.
8509 (when (file-exists-p buffer-auto-save-file-name) 8509 (when (file-exists-p buffer-auto-save-file-name)
8510 (delete-file buffer-auto-save-file-name)))) 8510 (delete-file buffer-auto-save-file-name))
8511 ;; Don't leave modified and unsaved files, to avoid confirmation
8512 ;; prompts when exiting Emacs in interactive sessions.
8513 (restore-buffer-modified-p nil)))
8511 8514
8512 (ert-with-temp-file file 8515 (ert-with-temp-file file
8513 (setq file (file-truename file)) 8516 (setq file (file-truename file))
@@ -8518,7 +8521,10 @@ Finally, kill the buffer and its temporary file."
8518 (should (buffer-modified-p)) 8521 (should (buffer-modified-p))
8519 (should-not (eq (buffer-modified-p) 'autosaved)) 8522 (should-not (eq (buffer-modified-p) 'autosaved))
8520 (restore-buffer-modified-p 'autosaved) 8523 (restore-buffer-modified-p 'autosaved)
8521 (should (eq (buffer-modified-p) 'autosaved))))) 8524 (should (eq (buffer-modified-p) 'autosaved))
8525 ;; Don't leave modified and unsaved files, to avoid confirmation
8526 ;; prompts when exiting Emacs in interactive sessions.
8527 (restore-buffer-modified-p nil))))
8522 8528
8523(ert-deftest test-buffer-chars-modified-ticks () 8529(ert-deftest test-buffer-chars-modified-ticks ()
8524 "Test `buffer-chars-modified-tick'." 8530 "Test `buffer-chars-modified-tick'."
@@ -8532,7 +8538,11 @@ Finally, kill the buffer and its temporary file."
8532 (write-region text nil f2 nil 'silent) 8538 (write-region text nil f2 nil 'silent)
8533 (insert-file-contents f2) 8539 (insert-file-contents f2)
8534 (should (= (buffer-chars-modified-tick) (buffer-modified-tick))) 8540 (should (= (buffer-chars-modified-tick) (buffer-modified-tick)))
8535 (should (> (buffer-chars-modified-tick) 1))))))) 8541 (should (> (buffer-chars-modified-tick) 1))
8542 ;; Don't leave modified and unsaved files, to avoid
8543 ;; confirmation prompts when exiting Emacs in interactive
8544 ;; sessions.
8545 (restore-buffer-modified-p nil))))))
8536 8546
8537(ert-deftest test-labeled-narrowing () 8547(ert-deftest test-labeled-narrowing ()
8538 "Test `with-restriction' and `without-restriction'." 8548 "Test `with-restriction' and `without-restriction'."