From unknown Wed Jun 18 23:04:03 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#62152 <62152@debbugs.gnu.org> To: bug#62152 <62152@debbugs.gnu.org> Subject: Status: 29.0.60; `erts-run-test' does not properly set match data for `ert-test--erts-test' Reply-To: bug#62152 <62152@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:04:03 +0000 retitle 62152 29.0.60; `erts-run-test' does not properly set match data for= `ert-test--erts-test' reassign 62152 emacs submitter 62152 Troy Brown severity 62152 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 12 17:31:15 2023 Received: (at submit) by debbugs.gnu.org; 12 Mar 2023 21:31:15 +0000 Received: from localhost ([127.0.0.1]:33172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pbTHf-0002R5-90 for submit@debbugs.gnu.org; Sun, 12 Mar 2023 17:31:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:57986) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pbPXz-0004V5-PG for submit@debbugs.gnu.org; Sun, 12 Mar 2023 13:31:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbPXq-0002E3-Uj for bug-gnu-emacs@gnu.org; Sun, 12 Mar 2023 13:31:44 -0400 Received: from mail-ed1-f42.google.com ([209.85.208.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbPXo-0007i5-8e for bug-gnu-emacs@gnu.org; Sun, 12 Mar 2023 13:31:41 -0400 Received: by mail-ed1-f42.google.com with SMTP id er25so11770092edb.5 for ; Sun, 12 Mar 2023 10:31:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678642298; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OfWqaQUVpKfNQxfsOPz+kg/BCDpKnnydvacycg0oHCQ=; b=o6W8BJTFbX30MGYo26RUv0UcXyHG8NcqeLsC9WetGvu795Lh9I7veVyhkUwYZ3BzFX Ke6Q+njZEeuHcgXVqcMVaR3VoJ0RWoLg1r5zY4Sk6z/XocLifX88kT5NFmuNZNDL7ziE Mk+TygzgH4YVORiGw7f1lIMdZj47LIMOCXjQ/f8OrK8GzFVwMa50czSkGE79HYEG3TMU QYHiWWcRxbOX/QXIriqek81Pnn7SffAcJgmzdRYA+bC90DWCpV+Rt7L8zaDSSOBEwYKX Rktsza8VF+l7Qb3gv3ULoq4rcqG+eIB3sLJrSODg2FAI4mCmoz7UcxGQpWysaXWMYdtV Zd+g== X-Gm-Message-State: AO0yUKWwbtmIIvV4Tjv4KbWhBKZj1Zb+GD56gnzAV2k+EhrKVVpLkw3/ oxBtxxkAxL8OnlesLOzB+eTxYZ65sdT5QA== X-Google-Smtp-Source: AK7set+pxwZzCH63zZjkkhovUYcm1gVZk2VoQflFhMEvnFRzstTLRXolsAQpt5JF8G0ej8YwSFJonw== X-Received: by 2002:a17:906:cccf:b0:8b2:c2fc:178e with SMTP id ot15-20020a170906cccf00b008b2c2fc178emr28370420ejb.74.1678642297490; Sun, 12 Mar 2023 10:31:37 -0700 (PDT) Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com. [209.85.208.50]) by smtp.gmail.com with ESMTPSA id t25-20020a170906949900b008d427df3245sm2431272ejx.58.2023.03.12.10.31.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Mar 2023 10:31:37 -0700 (PDT) Received: by mail-ed1-f50.google.com with SMTP id cy23so39800754edb.12 for ; Sun, 12 Mar 2023 10:31:36 -0700 (PDT) X-Received: by 2002:a17:906:338b:b0:879:e5b2:e12d with SMTP id v11-20020a170906338b00b00879e5b2e12dmr14573195eja.13.1678642296765; Sun, 12 Mar 2023 10:31:36 -0700 (PDT) MIME-Version: 1.0 From: Troy Brown Date: Sun, 12 Mar 2023 13:31:25 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: 29.0.60; `erts-run-test' does not properly set match data for `ert-test--erts-test' To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=209.85.208.42; envelope-from=troy.s.brown@gmail.com; helo=mail-ed1-f42.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 12 Mar 2023 17:31:14 -0400 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: -2.1 (--) `ert-test--erts-test' is expecting match data to exist (i.e., set by the caller) for the beginning of the test. This is used to locate the test specification data (e.g., 'Name'). However, when this function is invoked via `erts-run-test', it appears this match data (established by the call to `erts-mode--goto-start-of-test') is overwritten by the call to `erts-mode--preceding-spec' to locate "Point-Char". In this situation, if "Point-Char" exists in the test specification and appears prior to "Name" in the test specification, the "Name" specification will not be able to be located (due to the expected match location having been moved higher in the buffer). As a result a "No name for test case" error will be raised. Here is an ERTS test which can be used to reproduce this problem. Pressing C-c C-c when in `erts-mode' with the following will exhibit the problem. Code: (lambda () (fundamental-mode) (newline)) Point-Char: | Name: Simple Test =-= Hi| there =-= Hi | there =-=-= This particular issue can be fixed by wrapping the call to `erts-mode--preceding-spec` with `save-match-data', but it might be even better to incorporate that into `erts-mode--preceding-spec' itself. (save-excursion (erts-mode--goto-start-of-test) (condition-case arg (ert-test--erts-test (list (cons 'dummy t) (cons 'code (car (read-from-string test-function))) - (cons 'point-char (erts-mode--preceding-spec "Point-Char"))) + (cons 'point-char + (save-match-data + (erts-mode--preceding-spec "Point-Char")))) (buffer-file-name)) (:success (message "Test successful"))