]> git.eshelyaron.com Git - emacs.git/commitdiff
Add test for the fix in the parent commit
authorDmitry Gutov <dgutov@yandex.ru>
Sat, 17 Jun 2017 00:54:06 +0000 (03:54 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 17 Jun 2017 00:55:49 +0000 (03:55 +0300)
* test/src/undo-tests.el (undo-test-skip-invalidated-markers):
New test, for the fix in the parent commit.

test/src/undo-tests.el

index fbd3bf84a4275a4a1401c3602e5c583de04adfc6..0cf7fc9f59c79e6898a7c09b5a39e366ab6b85f7 100644 (file)
@@ -444,5 +444,27 @@ Demonstrates bug 16818."
       (ert-run-tests-interactively "^undo-")
     (ert-run-tests-batch "^undo-")))
 
+(ert-deftest undo-test-skip-invalidated-markers ()
+  "Test marker adjustment when the marker points nowhere.
+Demonstrates bug 25599."
+  (with-temp-buffer
+    (buffer-enable-undo)
+    (insert ";; aaaaaaaaa
+;; bbbbbbbb")
+    (let ((overlay-modified
+           (lambda (ov after-p _beg _end &optional length)
+             (unless after-p
+               (when (overlay-buffer ov)
+                 (delete-overlay ov))))))
+      (save-excursion
+        (goto-char (point-min))
+        (let ((ov (make-overlay (line-beginning-position 2)
+                                (line-end-position 2))))
+          (overlay-put ov 'insert-in-front-hooks
+                       (list overlay-modified)))))
+    (kill-region (point-min) (line-beginning-position 2))
+    (undo-boundary)
+    (undo)))
+
 (provide 'undo-tests)
 ;;; undo-tests.el ends here