aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJoão Távora2014-04-05 00:31:02 +0100
committerJoão Távora2014-04-05 00:31:02 +0100
commit5cb0cc903f64607a07b4cb3129f28e2cc072f5d7 (patch)
treefbfc3b0f3be3d9018b10a562adf5a89496b82030 /test
parent6b31e6b1ec3bc8b69c522dcabe0bf1e2eab03710 (diff)
downloademacs-5cb0cc903f64607a07b4cb3129f28e2cc072f5d7.tar.gz
emacs-5cb0cc903f64607a07b4cb3129f28e2cc072f5d7.zip
Improve on previous quote autopairing change
* lisp/elec-pair.el: (electric-pair--syntax-ppss): When inside comments parse from comment beginning. (electric-pair--balance-info): Fix typo in comment. (electric-pair--in-unterminated-string-p): Delete. (electric-pair--unbalanced-strings-p): New function. (electric-pair-string-bound-function): New var. (electric-pair-inhibit-if-helps-balance): Decide quote pairing according to `electric-pair--in-unterminated-string-p' * test/automated/electric-tests.el (define-electric-pair-test): Don't overtest.. (inhibit-in-mismatched-string-inside-ruby-comments): New test. (inhibit-in-mismatched-string-inside-c-comments): New test.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog7
-rw-r--r--test/automated/electric-tests.el44
2 files changed, 50 insertions, 1 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index be845db162a..4b1e352051b 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,10 @@
12014-04-04 João Távora <joaotavora@gmail.com>
2
3 * automated/electric-tests.el (define-electric-pair-test): Don't
4 overtest..
5 (inhibit-in-mismatched-string-inside-ruby-comments): New test.
6 (inhibit-in-mismatched-string-inside-c-comments): New test.
7
12014-04-02 João Távora <joaotavora@gmail.com> 82014-04-02 João Távora <joaotavora@gmail.com>
2 9
3 * automated/electric-tests.el (inhibit-if-strings-mismatched): 10 * automated/electric-tests.el (inhibit-if-strings-mismatched):
diff --git a/test/automated/electric-tests.el b/test/automated/electric-tests.el
index c43b87f3f81..9f0973e16b3 100644
--- a/test/automated/electric-tests.el
+++ b/test/automated/electric-tests.el
@@ -141,7 +141,7 @@ Should %s \"%s\" and point at %d"
141 expected-string 141 expected-string
142 expected-point 142 expected-point
143 bindings 143 bindings
144 (modes '(quote (emacs-lisp-mode ruby-mode c++-mode))) 144 (modes '(quote (ruby-mode c++-mode)))
145 (test-in-comments t) 145 (test-in-comments t)
146 (test-in-strings t) 146 (test-in-strings t)
147 (test-in-code t) 147 (test-in-code t)
@@ -303,6 +303,48 @@ Should %s \"%s\" and point at %d"
303 :bindings `((electric-pair-text-syntax-table 303 :bindings `((electric-pair-text-syntax-table
304 . ,prog-mode-syntax-table))) 304 . ,prog-mode-syntax-table)))
305 305
306(define-electric-pair-test inhibit-in-mismatched-string-inside-ruby-comments
307 "foo\"\"
308#
309# \"bar\"
310# \" \"
311# \"
312#
313baz\"\""
314 "\""
315 :modes '(ruby-mode)
316 :test-in-strings nil
317 :test-in-comments nil
318 :expected-point 19
319 :expected-string
320 "foo\"\"
321#
322# \"bar\"\"
323# \" \"
324# \"
325#
326baz\"\""
327 :fixture-fn #'(lambda () (goto-char (point-min)) (search-forward "bar")))
328
329(define-electric-pair-test inhibit-in-mismatched-string-inside-c-comments
330 "foo\"\"/*
331 \"bar\"
332 \" \"
333 \"
334*/baz\"\""
335 "\""
336 :modes '(c-mode)
337 :test-in-strings nil
338 :test-in-comments nil
339 :expected-point 18
340 :expected-string
341 "foo\"\"/*
342 \"bar\"\"
343 \" \"
344 \"
345*/baz\"\""
346 :fixture-fn #'(lambda () (goto-char (point-min)) (search-forward "bar")))
347
306 348
307;;; More quotes, but now don't bind `electric-pair-text-syntax-table' 349;;; More quotes, but now don't bind `electric-pair-text-syntax-table'
308;;; to `prog-mode-syntax-table'. Use the defaults for 350;;; to `prog-mode-syntax-table'. Use the defaults for