+2014-04-06 João Távora <joaotavora@gmail.com>
+
+ * progmodes/python.el (python-electric-pair-string-delimiter): Fix
+ triple-quoting electricity. (Bug#17192)
+
2014-04-06 João Távora <joaotavora@gmail.com>
* elec-pair.el (electric-pair-post-self-insert-function): Don't
skip whitespace when `electric-pair-text-pairs' and
`electric-pair-pairs' were used. syntax to
- electric-pair--skip-whitespace. (Bug#17183)
+ electric-pair--skip-whitespace. (Bug#17183)
2014-04-06 Eli Zaretskii <eliz@gnu.org>
(let ((count 0))
(while (eq (char-before (- (point) count)) last-command-event)
(cl-incf count))
- (= count 3)))
- (save-excursion (insert (make-string 3 last-command-event)))))
+ (= count 3))
+ (eq (char-after) last-command-event))
+ (save-excursion (insert (make-string 2 last-command-event)))))
(defvar electric-indent-inhibit)
+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):
\f
;;; 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))))))
+
\f
;;; Indentation
(equal (symbol-value (car ccons)) (cdr ccons)))))
(kill-buffer buffer)))
+\f
+;;; Electricity
+
(ert-deftest python-util-forward-comment-1 ()
(python-tests-with-temp-buffer
(concat
(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)