summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2014-04-08 21:50:29 -0400
committerGlenn Morris <rgm@gnu.org>2014-04-08 21:50:29 -0400
commit50c9a9b8a871ce281b43a196bd912f3d2fdda5fa (patch)
treec0b2459abdbf5fce686966c9a5d1d0816cb03114
parent3b7fab25046801a0451dbce5ccd65153e02c93f7 (diff)
downloademacs-50c9a9b8a871ce281b43a196bd912f3d2fdda5fa.tar.gz
Fix python-triple-quote-pairing test
* test/automated/python-tests.el (python-triple-quote-pairing): Enable/disable electric-pair-mode as needed.
-rw-r--r--test/ChangeLog3
-rw-r--r--test/automated/python-tests.el54
2 files changed, 33 insertions, 24 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index cca4a247e39..8b9b507d1c7 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,5 +1,8 @@
2014-04-09 Glenn Morris <rgm@gnu.org>
+ * automated/python-tests.el (python-triple-quote-pairing):
+ Enable/disable electric-pair-mode as needed.
+
* automated/electric-tests.el (electric-pair-backspace-1):
Replace deleted function.
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index 8fe8f71264f..de963a670bc 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -2722,30 +2722,36 @@ def foo(a, b, c):
(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"))))
+ (require 'electric)
+ (let ((epm electric-pair-mode))
+ (unwind-protect
+ (progn
+ (python-tests-with-temp-buffer
+ "\"\"\n"
+ (or epm (electric-pair-mode 1))
+ (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"))))
+ (or epm (electric-pair-mode -1)))))
(provide 'python-tests)