emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding macro-generated ert test definitions


From: João Távora
Subject: Re: Finding macro-generated ert test definitions
Date: Wed, 23 May 2018 01:52:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Noam Postavsky <address@hidden> writes:

> On 22 May 2018 at 15:21, João Távora <address@hidden> wrote:
>
>> Also M-x ert-find-test-other-window could have helped you, but it
>> doesn't (brings me to the beginning of the file, which isn't helpful). I
>> don't know why, does anyone?
>
> It works by searching the source file for "(ert-deftest TEST-NAME",
> but in this case TEST-NAME doesn't occur in the source, it's produced
> at compile time by the define-electric-pair-test macro.
>
> See ert--find-test-regexp and find-function-search-for-symbol.
>
Oh. I naively thought that the byte-compiler was providing positional
hints to f-f-s-for-symbol, but it's just a text search:

from find-function-search-for-symbol:

  ;; `regexp' matches definitions using known forms like
  ;; `defun', or `defvar'.  But some functions/variables
  ;; are defined using special macros (or functions), so
  ;; if `regexp' can't find the definition, we look for
  ;; something of the form "(SOMETHING <symbol> ...)".
  ;; This fails to distinguish function definitions from
  ;; variable declarations (or even uses thereof), but is
  ;; a good pragmatic fallback.

(Had me fooled until now, so I guess it's not so bad)

João, wondering where in bytecomp.el this could be hooked up...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]