aboutsummaryrefslogtreecommitdiffstats
path: root/test/automated/python-tests.el
diff options
context:
space:
mode:
authorJoão Távora2014-04-07 00:23:45 +0100
committerJoão Távora2014-04-07 00:23:45 +0100
commit7aecc2f6ca3842395436f111449dbdcdce494ad5 (patch)
treec78d04a004e0e1185e78fb4fbe36f4729d8641e8 /test/automated/python-tests.el
parent89f20f76d8fa700d2a534834bf178ac8796d35cf (diff)
downloademacs-7aecc2f6ca3842395436f111449dbdcdce494ad5.tar.gz
emacs-7aecc2f6ca3842395436f111449dbdcdce494ad5.zip
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/automated/python-tests.el')
-rw-r--r--test/automated/python-tests.el39
1 files changed, 39 insertions, 0 deletions
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."
134 134
135;;; Font-lock and syntax 135;;; Font-lock and syntax
136 136
137(ert-deftest python-syntax-after-python-backspace ()
138 ;; `python-indent-dedent-line-backspace' garbles syntax
139 :expected-result :failed
140 (python-tests-with-temp-buffer
141 "\"\"\""
142 (goto-char (point-max))
143 (python-indent-dedent-line-backspace 1)
144 (should (string= (buffer-string) "\"\""))
145 (should (null (nth 3 (syntax-ppss))))))
146
137 147
138;;; Indentation 148;;; Indentation
139 149
@@ -2696,6 +2706,9 @@ def foo(a, b, c):
2696 (equal (symbol-value (car ccons)) (cdr ccons))))) 2706 (equal (symbol-value (car ccons)) (cdr ccons)))))
2697 (kill-buffer buffer))) 2707 (kill-buffer buffer)))
2698 2708
2709
2710;;; Electricity
2711
2699(ert-deftest python-util-forward-comment-1 () 2712(ert-deftest python-util-forward-comment-1 ()
2700 (python-tests-with-temp-buffer 2713 (python-tests-with-temp-buffer
2701 (concat 2714 (concat
@@ -2708,6 +2721,32 @@ def foo(a, b, c):
2708 (python-util-forward-comment -1) 2721 (python-util-forward-comment -1)
2709 (should (= (point) (point-min))))) 2722 (should (= (point) (point-min)))))
2710 2723
2724(ert-deftest python-triple-quote-pairing ()
2725 (python-tests-with-temp-buffer
2726 "\"\"\n"
2727 (goto-char (1- (point-max)))
2728 (let ((last-command-event ?\"))
2729 (call-interactively 'self-insert-command))
2730 (should (string= (buffer-string)
2731 "\"\"\"\"\"\"\n"))
2732 (should (= (point) 4)))
2733 (python-tests-with-temp-buffer
2734 "\n"
2735 (let ((last-command-event ?\"))
2736 (dotimes (i 3)
2737 (call-interactively 'self-insert-command)))
2738 (should (string= (buffer-string)
2739 "\"\"\"\"\"\"\n"))
2740 (should (= (point) 4)))
2741 (python-tests-with-temp-buffer
2742 "\"\n\"\"\n"
2743 (goto-char (1- (point-max)))
2744 (let ((last-command-event ?\"))
2745 (call-interactively 'self-insert-command))
2746 (should (= (point) (1- (point-max))))
2747 (should (string= (buffer-string)
2748 "\"\n\"\"\"\n"))))
2749
2711 2750
2712(provide 'python-tests) 2751(provide 'python-tests)
2713 2752