From: João Távora Date: Tue, 22 Jan 2019 14:36:54 +0000 (+0000) Subject: Remove tests of electric-pair-mode and CC-based modes X-Git-Tag: emacs-27.0.90~3762 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6ca4626c9fe33f78df685b4df7aca88abb272118;p=emacs.git 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. --- 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)