aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBarry O'Reilly2014-03-02 12:37:32 -0500
committerBarry O'Reilly2014-03-02 12:37:32 -0500
commite3d090b4c50756f1ed9db55553a98b515eec5eaa (patch)
tree9b0c093244886dc48b60d7b2a678cc6b6b97d6a6 /test
parentb923819c10d71fe1824d0c25787a16a38d08d926 (diff)
downloademacs-e3d090b4c50756f1ed9db55553a98b515eec5eaa.tar.gz
emacs-e3d090b4c50756f1ed9db55553a98b515eec5eaa.zip
* 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 9082f2ace2a..41416baa3aa 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,10 @@
12014-03-02 Barry O'Reilly <gundaetiapo@gmail.com>
2
3 * automated/undo-tests.el (undo-test-in-region-not-most-recent):
4 Add new test of undo in region.
5 (undo-test-in-region-eob): Add test case described at
6 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16411
7
12014-02-28 Michael Albinus <michael.albinus@gmx.de> 82014-02-28 Michael Albinus <michael.albinus@gmx.de>
2 9
3 * automated/tramp-tests.el (tramp--test-enabled) 10 * automated/tramp-tests.el (tramp--test-enabled)
diff --git a/test/automated/undo-tests.el b/test/automated/undo-tests.el
index 53af574a8ee..8a963f10028 100644
--- a/test/automated/undo-tests.el
+++ b/test/automated/undo-tests.el
@@ -226,6 +226,48 @@
226 (should-not (buffer-modified-p)))) 226 (should-not (buffer-modified-p))))
227 (delete-file tempfile)))) 227 (delete-file tempfile))))
228 228
229(ert-deftest undo-test-in-region-not-most-recent ()
230 "Test undo in region of an edit not the most recent."
231 (with-temp-buffer
232 (buffer-enable-undo)
233 (transient-mark-mode 1)
234 (insert "1111")
235 (undo-boundary)
236 (goto-char 2)
237 (insert "2")
238 (forward-char 2)
239 (undo-boundary)
240 (insert "3")
241 (undo-boundary)
242 ;; Highlight around "2", not "3"
243 (push-mark (+ 3 (point-min)) t t)
244 (setq mark-active t)
245 (goto-char (point-min))
246 (undo)
247 (should (string= (buffer-string)
248 "11131"))))
249
250(ert-deftest undo-test-in-region-eob ()
251 "Test undo in region of a deletion at EOB, demonstrating bug 16411."
252 (with-temp-buffer
253 (buffer-enable-undo)
254 (transient-mark-mode 1)
255 (insert "This sentence corrupted?")
256 (undo-boundary)
257 ;; Same as recipe at
258 ;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16411
259 (insert "aaa")
260 (undo-boundary)
261 (undo)
262 ;; Select entire buffer
263 (push-mark (point) t t)
264 (setq mark-active t)
265 (goto-char (point-min))
266 ;; Should undo the undo of "aaa", ie restore it.
267 (undo)
268 (should (string= (buffer-string)
269 "This sentence corrupted?aaa"))))
270
229(defun undo-test-all (&optional interactive) 271(defun undo-test-all (&optional interactive)
230 "Run all tests for \\[undo]." 272 "Run all tests for \\[undo]."
231 (interactive "p") 273 (interactive "p")