From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:60816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hW5wW-0003lq-NK for guix-patches@gnu.org; Wed, 29 May 2019 17:17:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hW5wU-0003lv-PN for guix-patches@gnu.org; Wed, 29 May 2019 17:17:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46549) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hW5wU-0003lr-M1 for guix-patches@gnu.org; Wed, 29 May 2019 17:17:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hW5wU-00032H-H3 for guix-patches@gnu.org; Wed, 29 May 2019 17:17:02 -0400 Subject: [bug#35929] [PATCH] tests: hackage: avoid mock, and extract test data Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190527194556.59710-1-rob@vllmrt.net> Date: Wed, 29 May 2019 23:16:22 +0200 In-Reply-To: <20190527194556.59710-1-rob@vllmrt.net> (Robert Vollmert's message of "Mon, 27 May 2019 21:45:56 +0200") Message-ID: <87woi9rmft.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Robert Vollmert Cc: 35929@debbugs.gnu.org Hi Robert, Robert Vollmert skribis: > +(define* (eval-test-with-cabal test-cabal package-pattern #:key (cabal-e= nvironment '())) > + (define port (open-input-string test-cabal)) > + (match (hackage->guix-package "foo" #:port port #:cabal-environment ca= bal-environment) > + (package-pattern #t) This pattern matches anything and binds the result to =E2=80=98package-patt= ern=E2=80=99: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (let ((pattern '(a b))) (match '(1 2 3) (pattern pattern))) $9 =3D (1 2 3) --8<---------------cut here---------------end--------------->8--- No more test failures! :-) The change you propose is a good idea but it needs to be implemented using a macro: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (define-syntax-rule (match-pattern obj pattern) (match obj (pattern #t) (_ #f))) scheme@(guile-user)> (match-pattern '(1 2 3) (a b c)) $14 =3D #t scheme@(guile-user)> (match-pattern '(1 2 3) (a b)) $15 =3D #f scheme@(guile-user)> (match-pattern '(7 7) (a a)) $16 =3D #t scheme@(guile-user)> (match-pattern '(1 2) (a a)) $17 =3D #f --8<---------------cut here---------------end--------------->8--- HTH! Ludo=E2=80=99.