emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/electric-pair-cleanup-and-49518-bugfix bf32762: Improve Python t


From: João Távora
Subject: scratch/electric-pair-cleanup-and-49518-bugfix bf32762: Improve Python triple-quote pairing tests for electric-pair-mode
Date: Mon, 20 Sep 2021 06:59:59 -0400 (EDT)

branch: scratch/electric-pair-cleanup-and-49518-bugfix
commit bf3276240e6990bd904813bafe07a8a69a5916af
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Improve Python triple-quote pairing tests for electric-pair-mode
    
    These tests were once passing incorrectly, i.e. the auto-pairing
    functionality they purport to guard wasn't really working.  Added a
    new test in hopes that regressions can be spotted in the future for
    the now-working functionality of Python triple-quote auto-pairing via
    electric-pair-mode.
    
    bug#49518
    
    * test/lisp/progmodes/python-tests.el
    (python-triple-double-quote-pairing): Rename from
    python-triple-quote-pairing.
    (python-triple-single-quote-pairing): New test.
---
 test/lisp/progmodes/python-tests.el | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index a172f0f..6ab9c62 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -5282,7 +5282,7 @@ urlpatterns = patterns('',
            (should (= (current-indentation) 23))))
       (or eim (electric-indent-mode -1)))))
 
-(ert-deftest python-triple-quote-pairing ()
+(ert-deftest python-triple-double-quote-pairing ()
   (let ((epm electric-pair-mode))
     (unwind-protect
         (progn
@@ -5309,6 +5309,33 @@ urlpatterns = patterns('',
                             "\"\n\"\"\"\n"))))
       (or epm (electric-pair-mode -1)))))
 
+(ert-deftest python-triple-single-quote-pairing ()
+  (let ((epm electric-pair-mode))
+    (unwind-protect
+        (progn
+          (python-tests-with-temp-buffer
+           "''\n"
+           (or epm (electric-pair-mode 1))
+           (goto-char (1- (point-max)))
+           (python-tests-self-insert ?')
+           (should (string= (buffer-string)
+                            "''''''\n"))
+           (should (= (point) 4)))
+          (python-tests-with-temp-buffer
+           "\n"
+           (python-tests-self-insert (list ?' ?' ?'))
+           (should (string= (buffer-string)
+                            "''''''\n"))
+           (should (= (point) 4)))
+          (python-tests-with-temp-buffer
+           "'\n''\n"
+           (goto-char (1- (point-max)))
+           (python-tests-self-insert ?')
+           (should (= (point) (1- (point-max))))
+           (should (string= (buffer-string)
+                            "'\n'''\n"))))
+      (or epm (electric-pair-mode -1)))))
+
 
 ;;; Hideshow support
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]