summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/python-tests.el
diff options
context:
space:
mode:
authorLele Gaifax <lele@metapensiero.it>2017-11-15 10:10:19 +0100
committerNoam Postavsky <npostavs@gmail.com>2017-12-02 09:35:44 -0500
commitc02c1f6be7befdaf4f3987148db18121e1081dae (patch)
tree935c1d71c2d0bcf41549cb6d240ca492697fbe54 /test/lisp/progmodes/python-tests.el
parent946bb6d2250ce81fc68ec0bca4e1bb79815f4a59 (diff)
downloademacs-c02c1f6be7befdaf4f3987148db18121e1081dae.tar.gz
Add tests on electric-indentation and Python multiline strings (Bug#29305)
* test/lisp/progmodes/python-tests.el (python-indent-electric-comma-inside-multiline-string, python-indent-electric-comma-after-multiline-string): New tests.
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
-rw-r--r--test/lisp/progmodes/python-tests.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index a59885637e9..010eb67160c 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -1109,6 +1109,37 @@ def fn(a, b, c=True):
(should (eq (car (python-indent-context)) :inside-string))
(should (= (python-indent-calculate-indentation) 4))))
+(ert-deftest python-indent-electric-comma-inside-multiline-string ()
+ "Test indentation ...."
+ (python-tests-with-temp-buffer
+ "
+a = (
+ '''\
+- foo,
+- bar
+'''
+"
+ (python-tests-look-at "- bar")
+ (should (eq (car (python-indent-context)) :inside-string))
+ (goto-char (line-end-position))
+ (python-tests-self-insert ",")
+ (should (= (current-indentation) 0))))
+
+(ert-deftest python-indent-electric-comma-after-multiline-string ()
+ "Test indentation ...."
+ (python-tests-with-temp-buffer
+ "
+a = (
+ '''\
+- foo,
+- bar'''
+"
+ (python-tests-look-at "- bar'''")
+ (should (eq (car (python-indent-context)) :inside-string))
+ (goto-char (line-end-position))
+ (python-tests-self-insert ",")
+ (should (= (current-indentation) 0))))
+
(ert-deftest python-indent-electric-colon-1 ()
"Test indentation case from Bug#18228."
(python-tests-with-temp-buffer