From 86fc154317c605a4f6434694d8e754446d37b733 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Sun, 7 Nov 2021 21:20:15 +0100 Subject: [PATCH] Fix intermittent electric test failures * test/lisp/electric-tests.el (whitespace-chomping-dont-cross-comments): Move 'c-toggle-comment-style' to here.: (bug#51665). --- test/lisp/electric-tests.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 686641c1b33..1e32dbfb609 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -32,9 +32,6 @@ (require 'elec-pair) (require 'cl-lib) -;; When running tests in c-mode, use single-line comments (//). -(add-hook 'c-mode-hook (lambda () (c-toggle-comment-style -1))) - (defun call-with-saved-electric-modes (fn) (let ((saved-electric (if electric-pair-mode 1 -1)) (saved-layout (if electric-layout-mode 1 -1)) @@ -431,7 +428,9 @@ baz\"\"" :bindings '((electric-pair-skip-whitespace . chomp)) :test-in-strings nil :test-in-code nil - :test-in-comments t) + :test-in-comments t + :fixture-fn (lambda () (when (eq major-mode 'c-mode) + (c-toggle-comment-style -1)))) (define-electric-pair-test whitespace-skipping-for-quotes-not-outside " \" \"" "\"-----" :expected-string "\"\" \" \"" -- 2.39.5