aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLele Gaifax2017-11-15 10:10:19 +0100
committerNoam Postavsky2017-12-02 09:35:44 -0500
commitc02c1f6be7befdaf4f3987148db18121e1081dae (patch)
tree935c1d71c2d0bcf41549cb6d240ca492697fbe54
parent946bb6d2250ce81fc68ec0bca4e1bb79815f4a59 (diff)
downloademacs-c02c1f6be7befdaf4f3987148db18121e1081dae.tar.gz
emacs-c02c1f6be7befdaf4f3987148db18121e1081dae.zip
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.
-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):
1109 (should (eq (car (python-indent-context)) :inside-string)) 1109 (should (eq (car (python-indent-context)) :inside-string))
1110 (should (= (python-indent-calculate-indentation) 4)))) 1110 (should (= (python-indent-calculate-indentation) 4))))
1111 1111
1112(ert-deftest python-indent-electric-comma-inside-multiline-string ()
1113 "Test indentation ...."
1114 (python-tests-with-temp-buffer
1115 "
1116a = (
1117 '''\
1118- foo,
1119- bar
1120'''
1121"
1122 (python-tests-look-at "- bar")
1123 (should (eq (car (python-indent-context)) :inside-string))
1124 (goto-char (line-end-position))
1125 (python-tests-self-insert ",")
1126 (should (= (current-indentation) 0))))
1127
1128(ert-deftest python-indent-electric-comma-after-multiline-string ()
1129 "Test indentation ...."
1130 (python-tests-with-temp-buffer
1131 "
1132a = (
1133 '''\
1134- foo,
1135- bar'''
1136"
1137 (python-tests-look-at "- bar'''")
1138 (should (eq (car (python-indent-context)) :inside-string))
1139 (goto-char (line-end-position))
1140 (python-tests-self-insert ",")
1141 (should (= (current-indentation) 0))))
1142
1112(ert-deftest python-indent-electric-colon-1 () 1143(ert-deftest python-indent-electric-colon-1 ()
1113 "Test indentation case from Bug#18228." 1144 "Test indentation case from Bug#18228."
1114 (python-tests-with-temp-buffer 1145 (python-tests-with-temp-buffer