From: Kévin Le Gouguec Date: Tue, 19 May 2020 21:17:04 +0000 (+0200) Subject: Add test for bug#39680 X-Git-Tag: emacs-28.0.90~7316 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5352bda4eeb7415ad2bda5d74e007b4f36021e68;p=emacs.git Add test for bug#39680 * test/lisp/electric-tests.el (electric-pair-undo-unrelated-state): New test. --- diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 56d1bdb110e..67f474cbd52 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -546,6 +546,24 @@ baz\"\"" (electric-pair-delete-pair 1) (should (equal "" (buffer-string)))))) + +;;; Undoing +(ert-deftest electric-pair-undo-unrelated-state () + "Make sure `electric-pair-mode' does not confuse `undo' (bug#39680)." + (with-temp-buffer + (buffer-enable-undo) + (electric-pair-local-mode) + (let ((last-command-event ?\()) + (ert-simulate-command '(self-insert-command 1))) + (undo-boundary) + (let ((last-command-event ?a)) + (ert-simulate-command '(self-insert-command 1))) + (undo-boundary) + (ert-simulate-command '(undo)) + (let ((last-command-event ?\()) + (ert-simulate-command '(self-insert-command 1))) + (should (string= (buffer-string) "(())")))) + ;;; Electric newlines between pairs ;;; TODO: better tests