Commit 6ca4626c authored by João Távora's avatar João Távora
Browse files

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
parent 9eaf5e05
......@@ -157,7 +157,7 @@ The buffer's contents should %s:
(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
......@@ -817,7 +823,7 @@ baz\"\""
(ert-deftest electric-layout-int-main-kernel-style ()
(ert-with-test-buffer ()
(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 ()
(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 ()
(electric-layout-local-mode 1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment