From unknown Fri Aug 15 15:34:48 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#21742 <21742@debbugs.gnu.org> To: bug#21742 <21742@debbugs.gnu.org> Subject: Status: 25.0.50; Document that ert-deftest expands all macros Reply-To: bug#21742 <21742@debbugs.gnu.org> Date: Fri, 15 Aug 2025 22:34:48 +0000 retitle 21742 25.0.50; Document that ert-deftest expands all macros reassign 21742 emacs submitter 21742 immerrr again severity 21742 minor tag 21742 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 23 04:56:14 2015 Received: (at submit) by debbugs.gnu.org; 23 Oct 2015 08:56:14 +0000 Received: from localhost ([127.0.0.1]:33773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZpY8z-0001f8-5d for submit@debbugs.gnu.org; Fri, 23 Oct 2015 04:56:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47097) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZpY8f-0001eJ-1y for submit@debbugs.gnu.org; Fri, 23 Oct 2015 04:56:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpY8c-0001nC-La for submit@debbugs.gnu.org; Fri, 23 Oct 2015 04:55:52 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpY8c-0001n8-IE for submit@debbugs.gnu.org; Fri, 23 Oct 2015 04:55:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpY8a-0003Ds-O0 for bug-gnu-emacs@gnu.org; Fri, 23 Oct 2015 04:55:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpY8Y-0001ll-QA for bug-gnu-emacs@gnu.org; Fri, 23 Oct 2015 04:55:48 -0400 Received: from mail-wi0-x243.google.com ([2a00:1450:400c:c05::243]:35851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpY8Y-0001lh-G4 for bug-gnu-emacs@gnu.org; Fri, 23 Oct 2015 04:55:46 -0400 Received: by wibvt6 with SMTP id vt6so3599053wib.3 for ; Fri, 23 Oct 2015 01:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=l5tE8CErwdR8XSorcPkgCnxqws+NdWfxONThTt5Q120=; b=wovBz3MNwcYljee1Ho3eBUjJWeaGGmF7pyWG/xbmN6hsjF5XQ196MCzzavU311tTmU 7U5Kk4L8j/EUSRDpNDLvvvW3bxWM9hoMK+QKc7PDOH+o5bjnB0j3swv6Qgvu0nrBd7dF LPpEjsC3lNBazvgYtpv0aOXSqLP6+obUTf85pOnE2JUQJcMY1Q4+9Q6nKM/FjcT2JynC BdBrDhLEvbn+EkIUrShorI8t7QjZKubNcqEJQ2btRuRGRmbQV3zY+Oh+EHhGB12YwtSH jG+1VWE+sICg3cxq4ao9zSkYsjsJf9uESLY17w7Ffjx1njcZuklAakeemD6inKvOEmta GXww== MIME-Version: 1.0 X-Received: by 10.180.76.240 with SMTP id n16mr2964964wiw.11.1445590545462; Fri, 23 Oct 2015 01:55:45 -0700 (PDT) Received: by 10.27.170.140 with HTTP; Fri, 23 Oct 2015 01:55:45 -0700 (PDT) Date: Fri, 23 Oct 2015 11:55:45 +0300 Message-ID: Subject: 25.0.50; Document that ert-deftest expands all macros From: immerrr again To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) I wrote a library ample-regexps [1] that does some macro magic to extend rx and ran into an issue with ert when tests started failing without any explanation. I started digging and here's what I found. The library provides a macro called `define-arx` which roughly expands to ([2]) (eval-and-compile (defvar SOME-VAR ...) (defun SOME-FUN (...) ...) (defmacro SOME-MACRO (...) (SOME-FUN ...)) ...) The whole expansion is wrapped into eval-and-compile so that it can be used in a library during byte-compilation. I wrote a macro to use in tests that expands to roughly (progn (define-arx ...) (unwind-protect ,@body (fmakunbound SOME-MACRO) (fmakunbound SOME-FUN) (makunbound SOME-VAR))) The macro worked when executed manually, but not during tests. I started grepping and xref-ing through the code till I found that ert-deftest includes cl-macrolet which in turn runs macroexpand-all on the test definition. Quite expectedly, it expands the define-arx macro that results in eval-and-compile which is also expanded and all that's left in the resulting test definition is a symbol. More importantly, all side effects, i.e. function/macro definitions happen during test definition while they should really happen during test execution. I ended up using (eval (quote (define-arx ...))) to prevent early expansion, but it would really be nice if this was documented (would have saved me an hour-something of what-is-going-on and couple hours of how-do-i-stop-that). Or if that expansion didn't happen in the first place, but I guess that's not easy since it does that to expand all the (should ...) forms and test helpers to improve test run time. 1. https://github.com/immerrr/ample-regexps.el 2. https://github.com/immerrr/ample-regexps.el/blob/8368cc16e724cea1f60755fe40e25fe374b24418/ample-regexps.el#L339-L371 In GNU Emacs 25.0.50.10 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2) of 2015-10-12 Repository revision: 149066dbfc7f11c40f6dbed70a3279153bf3ab7a Windowing system distributor 'The X.Org Foundation', version 11.0.11103000 System Description: Ubuntu 12.04.5 LTS Configured using: 'configure --prefix=/home/immerrr/.local' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LC_TIME: en_GB.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: el Minor modes in effect: global-git-commit-mode: t global-undo-tree-mode: t undo-tree-mode: t diff-auto-refine-mode: t nameless-mode: t whitespace-mode: t flycheck-mode: t guide-key-mode: t global-company-mode: t company-mode: t pyvenv-mode: t paredit-mode: t auto-compile-on-save-mode: t auto-compile-mode: t recentf-mode: t shell-dirtrack-mode: t async-bytecomp-package-mode: t projectile-global-mode: t projectile-mode: t yas-global-mode: t yas-minor-mode: t save-place-mode: t show-paren-mode: t override-global-mode: t global-linum-mode: t linum-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent messages: Making completion list... [2 times] mouse-2, RET: find function's definition uncompressing bytecomp.el.gz...done Mark set Mark saved where search started Mark set Making completion list... Load-path shadows: /home/immerrr/.emacs.d/elpa/helm-20150921.1209/helm-multi-match hides /home/immerrr/.emacs.d/elpa/helm-core-20150921.1209/helm-multi-match Features: (shadow sort mail-extr emacsbug sendmail yaml-mode gravatar url-cache git-rebase log-view vc-annotate macrostep ielm goto-chg novice network-stream nsm starttls warnings company-jedi jedi-core epc ctable concurrent python bs ag vc-svn find-dired mc-mark-more multiple-cursors-core rect make-mode magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit magit-apply magit-wip magit-log magit-diff smerge-mode magit-core magit-process magit-popup magit-mode magit-git crm magit-section magit-utils git-commit log-edit message rfc822 mml mml-sec mailabbrev gmm-utils mailheader pcvs-util add-log with-editor server ert ewoc debug align tabify two-column iso-transl face-remap cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs ido seq eieio-opt speedbar sb-image ezimage dframe trace undo-tree diff misearch multi-isearch pulse jka-compr executable edebug test-helper ample-regexps vc vc-dispatcher vc-git diff-mode company-elisp nameless disp-table whitespace flycheck find-func subr-x guide-key s ucs-normalize popwin image-file winner wgrep traad request-deferred request url-http tls url-auth url-gw mail-utils popup python-environment deferred company-files company-oddmuse company-keywords company-etags etags xref project company-gtags company-dabbrev-code company-dabbrev company-capf company-cmake company-xcode company-clang company-semantic company-eclim company-template company-css company-nxml company-bbdb company pyvenv paredit auto-compile packed tramp-cache tramp-sh recentf tree-widget wid-edit helm-projectile helm-files rx image-dired tramp tramp-compat tramp-loaddefs trampver shell pcomplete format-spec dired-x dired-aux ffap helm-tags helm-bookmark helm-adaptive helm-info bookmark pp helm-external helm-net browse-url xml url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse auth-source gnus-util password-cache url-vars mailcap helm-buffers helm-grep helm-regexp helm-plugin helm-elscreen helm-utils helm-locate helm-help helm-types helm-config helm-easymenu async-bytecomp async helm-aliases helm helm-source eieio-compat eieio eieio-core cl-macs helm-multi-match helm-lib dired projectile grep compile comint ansi-color ibuf-ext ibuffer thingatpt yasnippet cl gv saveplace hydra ring lv paren solarized-dark-theme solarized-theme solarized dash byte-opt edmacro kmacro mmr-bootstrap quelpa-use-package cl-seq quelpa package-build mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr json lisp-mnt use-package bytecomp byte-compile cl-extra help-mode cconv bind-key easy-mmode cl-loaddefs pcase cl-lib diminish linum-ex bar-cursor advice mmr-minimal mmr-ediff windmove finder-inf info package easymenu epg-config time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 1017131 97896) (symbols 48 52825 1) (miscs 40 11688 6032) (strings 32 126665 12804) (string-bytes 1 3827188) (vectors 16 85648) (vector-slots 8 1983427 52910) (floats 8 1126 2620) (intervals 56 75316 4827) (buffers 976 104) (heap 1024 95787 17598)) From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 12 15:35:54 2019 Received: (at 21742) by debbugs.gnu.org; 12 Oct 2019 19:35:54 +0000 Received: from localhost ([127.0.0.1]:34221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iJNBB-00008Z-PZ for submit@debbugs.gnu.org; Sat, 12 Oct 2019 15:35:53 -0400 Received: from quimby.gnus.org ([80.91.231.51]:38488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iJNB9-00008O-Su for 21742@debbugs.gnu.org; Sat, 12 Oct 2019 15:35:52 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iJNB5-0007Tu-Nu; Sat, 12 Oct 2019 21:35:50 +0200 From: Lars Ingebrigtsen To: immerrr again Subject: Re: bug#21742: 25.0.50; Document that ert-deftest expands all macros References: Date: Sat, 12 Oct 2019 21:35:47 +0200 In-Reply-To: (immerrr again's message of "Fri, 23 Oct 2015 11:55:45 +0300") Message-ID: <874l0dlpt8.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: immerrr again writes: > I started grepping and xref-ing through the code till I found that > ert-deftest includes cl-macrolet which in turn runs macroexpand-all on > the test definition. Quite expectedly, it expands the de [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21742 Cc: 21742@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) immerrr again writes: > I started grepping and xref-ing through the code till I found that > ert-deftest includes cl-macrolet which in turn runs macroexpand-all on > the test definition. Quite expectedly, it expands the define-arx macro > that results in eval-and-compile which is also expanded and all that's > left in the resulting test definition is a symbol. More importantly, > all side effects, i.e. function/macro definitions happen during test > definition while they should really happen during test execution. I've now added this to the doc string. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 12 15:35:58 2019 Received: (at control) by debbugs.gnu.org; 12 Oct 2019 19:35:58 +0000 Received: from localhost ([127.0.0.1]:34224 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iJNBG-00008s-2l for submit@debbugs.gnu.org; Sat, 12 Oct 2019 15:35:58 -0400 Received: from quimby.gnus.org ([80.91.231.51]:38504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iJNBE-00008i-4E for control@debbugs.gnu.org; Sat, 12 Oct 2019 15:35:56 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iJNBB-0007UF-F4 for control@debbugs.gnu.org; Sat, 12 Oct 2019 21:35:55 +0200 Date: Sat, 12 Oct 2019 21:35:53 +0200 Message-Id: <8736fxlpt2.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #21742 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 21742 fixed close 21742 27.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 21742 fixed close 21742 27.1 quit From unknown Fri Aug 15 15:34:48 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 10 Nov 2019 12:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator