>From c83fbd50f0f0999814f09706fc908df5c22c5a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= Date: Tue, 19 May 2020 23:17:04 +0200 Subject: [PATCH] Add test for bug#39680 * test/lisp/electric-tests.el (electric-pair-undo-unrelated-state): New test. --- test/lisp/electric-tests.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 56d1bdb110..67f474cbd5 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -546,6 +546,24 @@ js-mode-braces-with-layout-and-indent (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 -- 2.26.2