summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2013-07-11 08:56:41 -0700
committerGlenn Morris <rgm@gnu.org>2013-07-11 08:56:41 -0700
commit7faba176ba38d88b749a9281868720440e154c26 (patch)
tree4cdbd07cb0e05ca8b97dcdf88493ea961d9ded01
parent88f6a933892e3e2830325266ae5dfa4bcef06d12 (diff)
* undo-tests.el (undo-test-buffer-modified, undo-test-file-modified): New tests.
-rw-r--r--test/ChangeLog5
-rw-r--r--test/automated/undo-tests.el26
2 files changed, 31 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 0a9bedcb5d..5e29dd4e8d 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-11 Glenn Morris <rgm@gnu.org>
+
+ * automated/undo-tests.el (undo-test-buffer-modified)
+ (undo-test-file-modified): New tests.
+
2013-07-09 Michael Albinus <michael.albinus@gmx.de>
* automated/file-notify-tests.el (file-notify-test00-availability):
diff --git a/test/automated/undo-tests.el b/test/automated/undo-tests.el
index 98b0c52728..87c55c5d37 100644
--- a/test/automated/undo-tests.el
+++ b/test/automated/undo-tests.el
@@ -200,6 +200,32 @@
'(error "Unrecognized entry in undo list \"bogus\""))))
(buffer-string))))))
+;; http://debbugs.gnu.org/14824
+(ert-deftest undo-test-buffer-modified ()
+ "Test undoing marks buffer unmodified."
+ (with-temp-buffer
+ (buffer-enable-undo)
+ (insert "1")
+ (undo-boundary)
+ (set-buffer-modified-p nil)
+ (insert "2")
+ (undo)
+ (should-not (buffer-modified-p))))
+
+(ert-deftest undo-test-file-modified ()
+ "Test undoing marks buffer visiting file unmodified."
+ (let ((tempfile (make-temp-file "undo-test")))
+ (unwind-protect
+ (progn
+ (with-current-buffer (find-file-noselect tempfile)
+ (insert "1")
+ (undo-boundary)
+ (set-buffer-modified-p nil)
+ (insert "2")
+ (undo)
+ (should-not (buffer-modified-p))))
+ (delete-file tempfile))))
+
(defun undo-test-all (&optional interactive)
"Run all tests for \\[undo]."
(interactive "p")