]> git.eshelyaron.com Git - emacs.git/commitdiff
Add undo-in-region test case for bug#21523
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 18 Aug 2021 13:32:19 +0000 (15:32 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 18 Aug 2021 13:32:23 +0000 (15:32 +0200)
test/lisp/simple-tests.el

index 4b153d117f0b71fb105f799e0e739256e3880b47..728911208ebb803202c42b7be9f18c74065868a6 100644 (file)
@@ -959,6 +959,17 @@ See Bug#21722."
       (with-shell-command-dont-erase-buffer str output-buffer-is-current
         (should (= (point) (alist-get shell-command-dont-erase-buffer expected-point)))))))
 
+(ert-deftest test-undo-region ()
+  (with-temp-buffer
+    (insert "This is a test\n")
+    (goto-char (point-min))
+    (setq buffer-undo-list nil)
+    (downcase-word 1)
+    (should (= (length (delq nil (undo-make-selective-list 1 9))) 2))
+    (should (= (length (delq nil (undo-make-selective-list 4 9))) 1))
+    ;; FIXME this is the off-by-one error case.
+    ;;(should (= (length (delq nil (undo-make-selective-list 5 9))) 0))
+    (should (= (length (delq nil (undo-make-selective-list 6 9))) 0)))
 
 (provide 'simple-test)
 ;;; simple-test.el ends here