From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Volf <~@wolfsden.cz> Newsgroups: gmane.lisp.guile.bugs Subject: bug#74030: [PATCH] srfi-64: Accept symbols as test group names. Date: Sat, 26 Oct 2024 18:06:51 +0200 Message-ID: <20241026160651.20915-1-~@wolfsden.cz> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40278"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Tomas Volf <~@wolfsden.cz> To: 74030@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Oct 26 18:08:02 2024 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t4jKb-000AHN-CB for guile-bugs@m.gmane-mx.org; Sat, 26 Oct 2024 18:08:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4jKJ-0005cf-3v; Sat, 26 Oct 2024 12:07:43 -0400 Original-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 1t4jK6-0005bt-Jr for bug-guile@gnu.org; Sat, 26 Oct 2024 12:07:32 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t4jK5-0005Mv-Ue for bug-guile@gnu.org; Sat, 26 Oct 2024 12:07:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=QMI2DrWYfw19LaEkiqx84NpSsOVG7ESWw29MsD3enFU=; b=nMDSvugYdK5HRkYXUbLzoAUNFu/GRx3B9sKMZCtC1jOVnBjmRPglfPvs74iaxdGyrj+z9n/uaVvlmoS0ET5dI7TrDGY1CbE3nEW2Hz7eQt/F2dKrYVORnIQ9bu18ShGsVhKh97o2kcbL4dRVa9onRsmGoNZw1jlKJLKIEnwUXvJt4/4aITOnvzimTQFu0YZbuP74iMB2RbA7G+uiF9Iaz2AWHrp5IVGU6AMvG0nafwckAomZH+2ZYI77oHdaJiQCpktqS6Gq5kpIkbPMWvd8DqfnVNzMju6jw5Ofi8QdtLwcPW+ajfA7bDoMs5YXVp3JVBgPQvkom7Cp9LVqW4qcxA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t4jKc-00051w-5J for bug-guile@gnu.org; Sat, 26 Oct 2024 12:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 26 Oct 2024 16:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74030 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.172995886319306 (code B ref -1); Sat, 26 Oct 2024 16:08:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Oct 2024 16:07:43 +0000 Original-Received: from localhost ([127.0.0.1]:42344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4jKJ-00051J-44 for submit@debbugs.gnu.org; Sat, 26 Oct 2024 12:07:43 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:44778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1t4jKH-000519-Ex for submit@debbugs.gnu.org; Sat, 26 Oct 2024 12:07:42 -0400 Original-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 <~@wolfsden.cz>) id 1t4jJe-0005Zd-Ps for bug-guile@gnu.org; Sat, 26 Oct 2024 12:07:02 -0400 Original-Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1t4jJc-0005Em-IN for bug-guile@gnu.org; Sat, 26 Oct 2024 12:07:02 -0400 Original-Received: by wolfsden.cz (Postfix, from userid 104) id 53A6432AD58; Sat, 26 Oct 2024 16:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1729958817; bh=KPXO0yW0oLZQzvz0eARK13FQNiEC3+H0f4j2FpxeVe8=; h=From:To:Cc:Subject:Date; b=oS7lPXyazVNkzDhW3cMzKvRw+xXqRWhZJ9OjUSPBMsZUSU7hd1/DLa0XejmKctjvl R8QPSkRzJUxf2hgHoPOfTTxQ697gNSbDzjpslD3exNNCtGInDgJylV++SUJF4S4KTs OBOFl+Cl3nDxEhMngvLBxF1NsVRnp3lMOJJIYgmYbwhqLflQ2hTeXStewEWjYa5QZ6 QRg8aFZIpi6C1XiuvGlZTDPfnxpzHQyVRcfWGwL+kzUaPd2ECrjjrtyjNuS15iP+Ic CKN6yO2yQ6/A8rLmV1INMHty1Wmkj1HyGz4rpZeQyBhon7cdDdCq8kVd20eUnYEAUZ VxLRqbuy4LdV2YNtFdDxiN31ymWCUrDfzB5vDlWTNCdyawEIG9gDWURrX3ckVG8X07 N64vkFzts7KXrAw4X2ZHHgion8hFuNfj1cR4K7QG3/U2iIU22tER/PI+o4wuXF/PZ9 mLPD0LiOQsTPvSxhMPVwJYtw35Iq214V/2u/LpM4eDiKwwLHBeAAMdgO1ZAYqnjTHz kv5Ybw7b3jLHZ1C3GdgLKtqjQRn0uIPfkCY+xWKJJBFH3NHfZ4vf2hByThPTJ5THPp MMtZPkh9hC9k9MyiW5W3SyRi8ZUXMn/YQQ6NmYxGlU9u9N3idlj3wZkHXU2OQs6tCw BaWIwqveyCxvLHvnq9Pz+OQ8= Original-Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 6B5CF32B5AA; Sat, 26 Oct 2024 16:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1729958816; bh=KPXO0yW0oLZQzvz0eARK13FQNiEC3+H0f4j2FpxeVe8=; h=From:To:Cc:Subject:Date; b=CHdNFMxyTulKTpEBdagAD9M2LfJROmsnVTiS3+U/YMoaK3l0zv4FWcFftu/+dHN1m d5Z8DNLgbYoAm+GBLLKeXozenYnHaN2bc//XKG0ET+RJUk/KQ+XlL+bTCQdKvPud6U cx+3exJfEYOo7WA7y8Mg4yAZX1SPA6uxWZtolYa1Q6Tw4f0e7e9OHU91yth8dszFeJ R6bpBN8RGCZCgEjl0wHm4r32TTO7d13xhI2JXgormYmCB+AHcl+gSbvUzfbUa6TFIq LvUaaT/eVyiqAt74xjSb9t9oswjRjFi9Z6kdoc4aaywtjE6tiONSrRDvO5g3XoIDYi Soc9nzn4hkHwPt6KcZ5NyoAh9zv4KSwUnFUuCq0CFczTT8iRJoS2ViG6eizLOAqQlc hSnIm7Ad0W2eN2zAMyjwJJ/Xr/LMltiJqCJs92BZtaByNQA/GUC48jokfut/u1Mlvq HqHSFJe45UQhUQ6m1dCs2M/TwuQg8WZViRykTFEx7cEcLG94kmuGIEaP3UwuSKOCtg lXE4DbHY4wgg0WSFPKckAG2AgM69pL8k7piszREqmWRI97+9cuIuNvWVxpq35pNjOK b/U2BwT4Ko5N/iGAjaoslq5NtyAbPIBRKrVEg36mD2Dhh+TDsKBHhYR9zpcvhhN+bf HnunthPfUlgav+mwPeLHqdxk= X-Mailer: git-send-email 2.46.0 Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz; helo=wolfsden.cz X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:11075 Archived-At: The specification mandates a string, but with rationale suggesting symbols would be a more natural fit. > In some ways using symbols would be preferable. However, we want > human-readable names, and standard Scheme does not provide a way to include > spaces or mixed-case text in literal symbols. Add support for symbols as implementation extension. * module/srfi/srfi-64.scm (%cmp-group-name): New procedure. (test-end): Use it. --- module/srfi/srfi-64.scm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/module/srfi/srfi-64.scm b/module/srfi/srfi-64.scm index 1f60a72e5..98fcef645 100644 --- a/module/srfi/srfi-64.scm +++ b/module/srfi/srfi-64.scm @@ -522,7 +522,10 @@ returning new test runner. Defaults to @code{test-runner-simple}.") (1+ (group-executed-count group))))))) (define* (test-begin suite-name #:optional count) - "Enter a new test group." + "Enter a new test group. + +As implementation extension, in addition to strings, symbols are also +supported as @var{suite-name}." (let* ((r (test-runner-current)) (r install? (if r (values r #f) @@ -544,6 +547,14 @@ returning new test runner. Defaults to @code{test-runner-simple}.") ((test-runner-on-group-begin r) r suite-name count))) +(define (%cmp-group-name a b) + (match (list a b) + (((? string?) (? string?)) + (string=? a b)) + (((? symbol?) (? symbol?)) + (eq? a b)) + (_ #f))) + (define* (test-end #:optional suite-name) "Leave the current test group." (let* ((r (test-runner-current)) @@ -551,7 +562,7 @@ returning new test runner. Defaults to @code{test-runner-simple}.") (let ((begin-name (car (test-runner-group-stack r))) (end-name suite-name)) - (when (and end-name (not (string=? begin-name end-name))) + (when (and end-name (not (%cmp-group-name begin-name end-name))) ((test-runner-on-bad-end-name r) r begin-name end-name) (raise-exception (make-bad-end-name begin-name end-name)))) -- 2.46.0