From: Glenn Morris Date: Thu, 11 Jul 2013 15:56:41 +0000 (-0700) Subject: * undo-tests.el (undo-test-buffer-modified, undo-test-file-modified): New tests. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1844 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7faba176ba38d88b749a9281868720440e154c26;p=emacs.git * undo-tests.el (undo-test-buffer-modified, undo-test-file-modified): New tests. --- diff --git a/test/ChangeLog b/test/ChangeLog index 0a9bedcb5d8..5e29dd4e8d0 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2013-07-11 Glenn Morris + + * automated/undo-tests.el (undo-test-buffer-modified) + (undo-test-file-modified): New tests. + 2013-07-09 Michael Albinus * automated/file-notify-tests.el (file-notify-test00-availability): diff --git a/test/automated/undo-tests.el b/test/automated/undo-tests.el index 98b0c52728b..87c55c5d374 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")