unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>, dick.r.chiang@gmail.com
Cc: 51665@debbugs.gnu.org
Subject: bug#51665: 28.0.50; [PATCH] Get electric-tests to pass
Date: Sun, 7 Nov 2021 10:31:50 -0800	[thread overview]
Message-ID: <975de290-b8d7-b40a-715e-afe544623a93@gmail.com> (raw)
In-Reply-To: <87o86wexxj.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]

On 11/7/2021 8:24 AM, Lars Ingebrigtsen wrote:
> dick.r.chiang@gmail.com writes:
> 
>> Subject: [PATCH] electric-tests can no longer by byte compiled
> 
> Isn't that the bug, though?  We've been trying to find out why.

I've been tinkering with this and I *think* the issue is with the hook I 
added at global scope:

   (add-hook 'c-mode-hook (lambda () (c-toggle-comment-style -1)))

In the attached patch, I moved this into a fixture function for the 
`whitespace-chomping-dont-cross-comments' test and it works for me (i.e. 
electric-tests pass both with and without byte-compilation). Hopefully 
this resolves the issue, though I'm unclear on *why* this was occurring 
in the first place; maybe there's a bug in the byte-compiler...?

(As an aside, I vaguely recall adding that hook at global scope because 
multiple tests failed without it, but it was a while since I wrote that 
patch and I may be misremembering. In any case, it seems that at least 
today, changing the comment style is only needed for that one test, so I 
think it makes sense to do it in a fixture solely for that test.)

[-- Attachment #2: 0001-Fix-electric-tests.patch --]
[-- Type: text/plain, Size: 1381 bytes --]

From 6df04751816f268124b3fab19ef5c9d2cd983002 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Sun, 7 Nov 2021 10:22:54 -0800
Subject: [PATCH] ; Fix electric-tests

* test/lisp/electric-tests.el
(whitespace-chomping-dont-cross-comments):
Move 'c-toggle-comment-style' to here.
---
 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 686641c1b3..1e32dbfb60 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 @@ whitespace-chomping-dont-cross-comments
   :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.25.1


  reply	other threads:[~2021-11-07 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-07 16:19 bug#51665: 28.0.50; [PATCH] Get electric-tests to pass dick.r.chiang
2021-11-07 16:24 ` Lars Ingebrigtsen
2021-11-07 18:31   ` Jim Porter [this message]
2021-11-07 20:19     ` Lars Ingebrigtsen
2021-11-07 17:25 ` Andy Moreton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=975de290-b8d7-b40a-715e-afe544623a93@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=51665@debbugs.gnu.org \
    --cc=dick.r.chiang@gmail.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).