diff options
author | João Távora <joaotavora@gmail.com> | 2019-01-22 14:36:54 +0000 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2019-01-22 16:41:01 +0000 |
commit | 6ca4626c9fe33f78df685b4df7aca88abb272118 (patch) | |
tree | b849b9c60cea405653caed954f19d4400f9e818a /test/lisp/electric-tests.el | |
parent | 9eaf5e052a802a7b0560f983f2bb786e13ce2488 (diff) | |
download | emacs-6ca4626c9fe33f78df685b4df7aca88abb272118.tar.gz emacs-6ca4626c9fe33f78df685b4df7aca88abb272118.tar.bz2 emacs-6ca4626c9fe33f78df685b4df7aca88abb272118.zip |
Remove tests of electric-pair-mode and CC-based modes
The behaviour previously observed in cc-mode-based-modes (and every
other major-mode) when electric-pair-mode or electric-layout-mode is
turned on may no longer be observed: this because CC-mode goes around
the generic implementation of electric-pair-mode.
An alternative is to bind every delimiter key like '{', '}', etc to
'self-insert-command, like most major modes already do, at the cost of
losing c-auto-newline functionality (which was incompatible anyway
before the recent changes of bug#33794).
* test/lisp/electric-tests.el
(electric-pair-test-for): No longer set it.
(define-electric-pair-test): Use js-mode instead of c++ mode,
which broke recently.
(whitespace-chomping-2): Add failing C++ test explicitly.
(electric-layout-int-main-kernel-style): Use plainer-c-mode.
(electric-layout-int-main-allman-style): Deleted.
(electric-modes-int-main-allman-style): Renamed from
electric-layout-int-main-allman-style.
Diffstat (limited to 'test/lisp/electric-tests.el')
-rw-r--r-- | test/lisp/electric-tests.el | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 5a4b20ed04e..0b076e4be01 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -157,7 +157,7 @@ The buffer's contents should %s: expected-string expected-point bindings - (modes '(quote (ruby-mode c++-mode))) + (modes '(quote (ruby-mode js-mode))) (test-in-comments t) (test-in-strings t) (test-in-code t) @@ -391,10 +391,16 @@ baz\"\"" :bindings '((electric-pair-skip-whitespace . chomp)) :test-in-comments nil) - -;; A test failure introduced by some changes in CC mode. Hopefully CC -;; mode will sort this out eventually, using some new e-p-m machinery. -;; See +(define-electric-pair-test whitespace-chomping-2 + " ( \n\t\t\n ) " "--)------" :expected-string " () " :expected-point 4 + :bindings '((electric-pair-skip-whitespace . chomp)) + :modes '(c++-mode) + :test-in-comments nil) +;; A test failure introduced by: +;; +;; bb591f139f: Enhance CC Mode's fontification, etc., of unterminated strings. +;; +;; Hopefully CC mode will sort this out eventually. See ;; https://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00535.html (setf (ert-test-expected-result-type @@ -817,7 +823,7 @@ baz\"\"" (ert-deftest electric-layout-int-main-kernel-style () (ert-with-test-buffer () - (c-mode) + (plainer-c-mode) (electric-layout-local-mode 1) (electric-pair-local-mode 1) (electric-indent-local-mode 1) @@ -828,19 +834,6 @@ baz\"\"" (call-interactively (key-binding `[,last-command-event]))) (should (equal (buffer-string) "int main () {\n \n}")))) -(ert-deftest electric-layout-int-main-allman-style () - (ert-with-test-buffer () - (c-mode) - (electric-layout-local-mode 1) - (electric-pair-local-mode 1) - (electric-indent-local-mode 1) - (setq-local electric-layout-rules - '((?\{ . (before after-stay after)))) - (insert "int main () ") - (let ((last-command-event ?\{)) - (call-interactively (key-binding `[,last-command-event]))) - (should (equal (buffer-string) "int main ()\n{\n \n}")))) - (define-derived-mode plainer-c-mode c-mode "pC" "A plainer/saner C-mode with no internal electric machinery." (c-toggle-electric-state -1) @@ -850,7 +843,7 @@ baz\"\"" (dolist (key '(?\" ?\' ?\{ ?\} ?\( ?\) ?\[ ?\])) (local-set-key (vector key) 'self-insert-command))) -(ert-deftest electric-modes-in-c-mode-with-self-insert-command () +(ert-deftest electric-modes-int-main-allman-style () (ert-with-test-buffer () (plainer-c-mode) (electric-layout-local-mode 1) |