aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBarry O'Reilly <[email protected]>2014-03-02 12:37:32 -0500
committerBarry O'Reilly <[email protected]>2014-03-02 12:37:32 -0500
commite3d090b4c50756f1ed9db55553a98b515eec5eaa (patch)
tree9b0c093244886dc48b60d7b2a678cc6b6b97d6a6 /test
parentb923819c10d71fe1824d0c25787a16a38d08d926 (diff)
* simple.el (undo-elt-in-region): Fix buffer corruption for edge
case of undo in region. * automated/undo-tests.el (undo-test-in-region-not-most-recent): Add new test of undo in region. (undo-test-in-region-eob): Add test case described at http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16411#41
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog7
-rw-r--r--test/automated/undo-tests.el42
2 files changed, 49 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 9082f2ace2..41416baa3a 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,10 @@
+2014-03-02 Barry O'Reilly <[email protected]>
+
+ * automated/undo-tests.el (undo-test-in-region-not-most-recent):
+ Add new test of undo in region.
+ (undo-test-in-region-eob): Add test case described at
+ http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16411
+
2014-02-28 Michael Albinus <[email protected]>
* automated/tramp-tests.el (tramp--test-enabled)
diff --git a/test/automated/undo-tests.el b/test/automated/undo-tests.el
index 53af574a8e..8a963f1002 100644
--- a/test/automated/undo-tests.el
+++ b/test/automated/undo-tests.el
@@ -226,6 +226,48 @@
(should-not (buffer-modified-p))))
(delete-file tempfile))))
+(ert-deftest undo-test-in-region-not-most-recent ()
+ "Test undo in region of an edit not the most recent."
+ (with-temp-buffer
+ (buffer-enable-undo)
+ (transient-mark-mode 1)
+ (insert "1111")
+ (undo-boundary)
+ (goto-char 2)
+ (insert "2")
+ (forward-char 2)
+ (undo-boundary)
+ (insert "3")
+ (undo-boundary)
+ ;; Highlight around "2", not "3"
+ (push-mark (+ 3 (point-min)) t t)
+ (setq mark-active t)
+ (goto-char (point-min))
+ (undo)
+ (should (string= (buffer-string)
+ "11131"))))
+
+(ert-deftest undo-test-in-region-eob ()
+ "Test undo in region of a deletion at EOB, demonstrating bug 16411."
+ (with-temp-buffer
+ (buffer-enable-undo)
+ (transient-mark-mode 1)
+ (insert "This sentence corrupted?")
+ (undo-boundary)
+ ;; Same as recipe at
+ ;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16411
+ (insert "aaa")
+ (undo-boundary)
+ (undo)
+ ;; Select entire buffer
+ (push-mark (point) t t)
+ (setq mark-active t)
+ (goto-char (point-min))
+ ;; Should undo the undo of "aaa", ie restore it.
+ (undo)
+ (should (string= (buffer-string)
+ "This sentence corrupted?aaa"))))
+
(defun undo-test-all (&optional interactive)
"Run all tests for \\[undo]."
(interactive "p")