]> git.eshelyaron.com Git - emacs.git/commitdiff
* undo-tests.el (undo-test-buffer-modified, undo-test-file-modified): New tests.
authorGlenn Morris <rgm@gnu.org>
Thu, 11 Jul 2013 15:56:41 +0000 (08:56 -0700)
committerGlenn Morris <rgm@gnu.org>
Thu, 11 Jul 2013 15:56:41 +0000 (08:56 -0700)
test/ChangeLog
test/automated/undo-tests.el

index 0a9bedcb5d8129083486186fde9c0898af4feaa2..5e29dd4e8d06a0124489a26d0746ee0e5077a3fc 100644 (file)
@@ -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):
index 98b0c52728b898beb5ce1d3608c1fefb5399d7a8..87c55c5d374f299dfe3a6a9b10fad39388ffe046 100644 (file)
                   '(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")