summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2014-04-07 00:23:45 +0100
committerJoão Távora <joaotavora@gmail.com>2014-04-07 00:23:45 +0100
commit7aecc2f6ca3842395436f111449dbdcdce494ad5 (patch)
treec78d04a004e0e1185e78fb4fbe36f4729d8641e8 /test
parent89f20f76d8fa700d2a534834bf178ac8796d35cf (diff)
downloademacs-7aecc2f6ca3842395436f111449dbdcdce494ad5.tar.gz
Fix triple-quoting electricity in python-mode
* lisp/progmodes/python.el (python-electric-pair-string-delimiter): Fix triple-quoting electricity. * test/automated/python-tests.el (python-triple-quote-pairing): New test. (python-syntax-after-python-backspace): New test. Fixes: debbugs:17192
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/automated/python-tests.el39
2 files changed, 44 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 846da9621fc..d483b0b2f9e 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,5 +1,10 @@
2014-04-06 João Távora <joaotavora@gmail.com>
+ * automated/python-tests.el (python-triple-quote-pairing): New test.
+ (python-syntax-after-python-backspace): New test.
+
+2014-04-06 João Távora <joaotavora@gmail.com>
+
* automated/electric-tests.el (electric-pair-define-test-form):
More readable test docstrings.
(whitespace-skipping-for-quotes-not-ouside)
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index dc58138ced4..8fe8f71264f 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -134,6 +134,16 @@ aliqua."
;;; Font-lock and syntax
+(ert-deftest python-syntax-after-python-backspace ()
+ ;; `python-indent-dedent-line-backspace' garbles syntax
+ :expected-result :failed
+ (python-tests-with-temp-buffer
+ "\"\"\""
+ (goto-char (point-max))
+ (python-indent-dedent-line-backspace 1)
+ (should (string= (buffer-string) "\"\""))
+ (should (null (nth 3 (syntax-ppss))))))
+
;;; Indentation
@@ -2696,6 +2706,9 @@ def foo(a, b, c):
(equal (symbol-value (car ccons)) (cdr ccons)))))
(kill-buffer buffer)))
+
+;;; Electricity
+
(ert-deftest python-util-forward-comment-1 ()
(python-tests-with-temp-buffer
(concat
@@ -2708,6 +2721,32 @@ def foo(a, b, c):
(python-util-forward-comment -1)
(should (= (point) (point-min)))))
+(ert-deftest python-triple-quote-pairing ()
+ (python-tests-with-temp-buffer
+ "\"\"\n"
+ (goto-char (1- (point-max)))
+ (let ((last-command-event ?\"))
+ (call-interactively 'self-insert-command))
+ (should (string= (buffer-string)
+ "\"\"\"\"\"\"\n"))
+ (should (= (point) 4)))
+ (python-tests-with-temp-buffer
+ "\n"
+ (let ((last-command-event ?\"))
+ (dotimes (i 3)
+ (call-interactively 'self-insert-command)))
+ (should (string= (buffer-string)
+ "\"\"\"\"\"\"\n"))
+ (should (= (point) 4)))
+ (python-tests-with-temp-buffer
+ "\"\n\"\"\n"
+ (goto-char (1- (point-max)))
+ (let ((last-command-event ?\"))
+ (call-interactively 'self-insert-command))
+ (should (= (point) (1- (point-max))))
+ (should (string= (buffer-string)
+ "\"\n\"\"\"\n"))))
+
(provide 'python-tests)