aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/python-tests.el
diff options
context:
space:
mode:
authorJoão Távora2021-09-19 17:08:41 +0100
committerJoão Távora2021-09-21 10:54:19 +0100
commit9ad962e118a17daf073ef5308233f9301755035d (patch)
tree0ee7ec3e5e3c144d3ba45f1459fac696fc7190d5 /test/lisp/progmodes/python-tests.el
parentf57ef8103139193f48d6c668212e17e476ed1678 (diff)
downloademacs-9ad962e118a17daf073ef5308233f9301755035d.tar.gz
emacs-9ad962e118a17daf073ef5308233f9301755035d.zip
Expand and improve electric-pair-mode and Python testing (bug#49518)
In python-tests.el, the triple-quote pairing tests are passing incorrectly, i.e. the auto-pairing functionality they purport to guard isn't really working for users trying it interactively. Added a new failing test, soon to be fixed. In electric-tests.el, added tests for Python, too. * test/lisp/electric-tests.el (define-electric-pair-test): Also run main tests for python-mode. (pair-some-quotes-skip-others): Test another slightly different pairing. * test/lisp/progmodes/python-tests.el (python-triple-double-quote-pairing): Rename from python-triple-quote-pairing. (python-triple-single-quote-pairing): New test.
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
-rw-r--r--test/lisp/progmodes/python-tests.el29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 1af579bb7a4..afdae4c75c6 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -5283,7 +5283,7 @@ urlpatterns = patterns('',
5283 (should (= (current-indentation) 23)))) 5283 (should (= (current-indentation) 23))))
5284 (or eim (electric-indent-mode -1))))) 5284 (or eim (electric-indent-mode -1)))))
5285 5285
5286(ert-deftest python-triple-quote-pairing () 5286(ert-deftest python-triple-double-quote-pairing ()
5287 (let ((epm electric-pair-mode)) 5287 (let ((epm electric-pair-mode))
5288 (unwind-protect 5288 (unwind-protect
5289 (progn 5289 (progn
@@ -5310,6 +5310,33 @@ urlpatterns = patterns('',
5310 "\"\n\"\"\"\n")))) 5310 "\"\n\"\"\"\n"))))
5311 (or epm (electric-pair-mode -1))))) 5311 (or epm (electric-pair-mode -1)))))
5312 5312
5313(ert-deftest python-triple-single-quote-pairing ()
5314 (let ((epm electric-pair-mode))
5315 (unwind-protect
5316 (progn
5317 (python-tests-with-temp-buffer
5318 "''\n"
5319 (or epm (electric-pair-mode 1))
5320 (goto-char (1- (point-max)))
5321 (python-tests-self-insert ?')
5322 (should (string= (buffer-string)
5323 "''''''\n"))
5324 (should (= (point) 4)))
5325 (python-tests-with-temp-buffer
5326 "\n"
5327 (python-tests-self-insert (list ?' ?' ?'))
5328 (should (string= (buffer-string)
5329 "''''''\n"))
5330 (should (= (point) 4)))
5331 (python-tests-with-temp-buffer
5332 "'\n''\n"
5333 (goto-char (1- (point-max)))
5334 (python-tests-self-insert ?')
5335 (should (= (point) (1- (point-max))))
5336 (should (string= (buffer-string)
5337 "'\n'''\n"))))
5338 (or epm (electric-pair-mode -1)))))
5339
5313 5340
5314;;; Hideshow support 5341;;; Hideshow support
5315 5342