From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: call for more ert tests Date: Mon, 24 Jun 2013 23:02:14 -0400 Message-ID: References: <838v1zjrnl.fsf@gnu.org> <8361x3jqsy.fsf@gnu.org> <8338s7jp53.fsf@gnu.org> <87bo6vb8uo.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1372129342 25390 80.91.229.3 (25 Jun 2013 03:02:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Jun 2013 03:02:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 25 05:02:20 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UrJWO-0005Zl-81 for ged-emacs-devel@m.gmane.org; Tue, 25 Jun 2013 05:02:20 +0200 Original-Received: from localhost ([::1]:44882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrJWN-00060C-S1 for ged-emacs-devel@m.gmane.org; Mon, 24 Jun 2013 23:02:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrJWK-000605-Te for emacs-devel@gnu.org; Mon, 24 Jun 2013 23:02:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrJWK-0005V6-5f for emacs-devel@gnu.org; Mon, 24 Jun 2013 23:02:16 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:9676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrJWK-0005V2-1w for emacs-devel@gnu.org; Mon, 24 Jun 2013 23:02:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFMCppA/2dsb2JhbABEvw4Xc4IeAQEEAR05KAsLNBIUGA2IQgbBLY1hTYJcA6R6gV6Caik X-IPAS-Result: Av4EABK/CFFMCppA/2dsb2JhbABEvw4Xc4IeAQEEAR05KAsLNBIUGA2IQgbBLY1hTYJcA6R6gV6Caik X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="17087939" Original-Received: from 76-10-154-64.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([76.10.154.64]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 24 Jun 2013 23:02:10 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 02FAAAE246; Mon, 24 Jun 2013 23:02:14 -0400 (EDT) In-Reply-To: (John Wiegley's message of "Mon, 24 Jun 2013 21:44:20 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161004 Archived-At: >>> One thing that would help with that is to allow structural pattern >>> matching. For example, say I have a function `foo` which returns a list >>> '(a b c), but all I care about is that `b` is `b`. Then I could write: >>> >>> (shouldBe (foo) '(_ b _)) >>> >>> `shouldBe` then raises an exception if the pattern fails to match. >> Use pcase? > pcase does not imply an assertion of equality, which the above does. I'm not > capturing the second element of the list in a variable named 'b', I'm > asserting that the second element is equal to the symbol 'b'. I think he means that it should be easy to make a shouldbe-pcase macro that provides this kind of behavior using using pcase (the pattern would look like `(,_ b ,_) instead of the one you wrote). Stefan