Add test for bug#39680
authorKévin Le Gouguec <kevin.legouguec@gmail.com>
Tue, 19 May 2020 21:17:04 +0000 (23:17 +0200)
committerJoão Távora <joaotavora@gmail.com>
Tue, 19 May 2020 23:15:11 +0000 (00:15 +0100)
* test/lisp/electric-tests.el (electric-pair-undo-unrelated-state):
New test.

test/lisp/electric-tests.el

index 56d1bdb110e3ad427287e2d7a74e4708d7f54d38..67f474cbd52303f72211c10ddcb2c583db6f68c6 100644 (file)
@@ -546,6 +546,24 @@ baz\"\""
       (electric-pair-delete-pair 1)
       (should (equal "" (buffer-string))))))
 
+\f
+;;; 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) "(())"))))
+
 \f
 ;;; Electric newlines between pairs
 ;;; TODO: better tests