From: "Ludovic Courtès" <ludo@gnu.org>
To: Robert Vollmert <rob@vllmrt.net>
Cc: 35929@debbugs.gnu.org
Subject: [bug#35929] [PATCH] tests: hackage: avoid mock, and extract test data
Date: Wed, 29 May 2019 23:16:22 +0200 [thread overview]
Message-ID: <87woi9rmft.fsf@gnu.org> (raw)
In-Reply-To: <20190527194556.59710-1-rob@vllmrt.net> (Robert Vollmert's message of "Mon, 27 May 2019 21:45:56 +0200")
Hi Robert,
Robert Vollmert <rob@vllmrt.net> skribis:
> +(define* (eval-test-with-cabal test-cabal package-pattern #:key (cabal-environment '()))
> + (define port (open-input-string test-cabal))
> + (match (hackage->guix-package "foo" #:port port #:cabal-environment cabal-environment)
> + (package-pattern #t)
This pattern matches anything and binds the result to ‘package-pattern’:
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (let ((pattern '(a b)))
(match '(1 2 3) (pattern pattern)))
$9 = (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 = #t
scheme@(guile-user)> (match-pattern '(1 2 3) (a b))
$15 = #f
scheme@(guile-user)> (match-pattern '(7 7) (a a))
$16 = #t
scheme@(guile-user)> (match-pattern '(1 2) (a a))
$17 = #f
--8<---------------cut here---------------end--------------->8---
HTH!
Ludo’.
next prev parent reply other threads:[~2019-05-29 21:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 19:45 [bug#35929] [PATCH] tests: hackage: avoid mock, and extract test data Robert Vollmert
2019-05-29 21:16 ` Ludovic Courtès [this message]
2019-05-29 21:25 ` Robert Vollmert
2019-05-30 11:42 ` Robert Vollmert
2019-05-31 17:57 ` Ludovic Courtès
2019-05-30 11:46 ` [bug#35929] [PATCH 1/2] tests: hackage: Factor out package pattern Robert Vollmert
2019-05-30 11:46 ` [bug#35929] [PATCH 2/2] tests: hackage: Don't mock hackage-fetch Robert Vollmert
2019-05-31 19:36 ` [bug#35929] [PATCH 1/2] tests: hackage: Factor out package pattern Robert Vollmert
2019-05-31 19:36 ` [bug#35929] [PATCH 2/2] tests: hackage: Don't mock hackage-fetch Robert Vollmert
2019-05-31 21:22 ` [bug#35929] [PATCH 1/3] tests: hackage: Factor out package pattern Robert Vollmert
2019-05-31 21:22 ` [bug#35929] [PATCH 2/3] tests: hackage: Don't mock hackage-fetch Robert Vollmert
2019-05-31 21:22 ` [bug#35929] [PATCH 3/3] tests: Indent hackage tests Robert Vollmert
2019-05-31 21:23 ` [bug#35929] [PATCH 1/3] tests: hackage: Factor out package pattern Robert Vollmert
2019-06-01 12:53 ` bug#35929: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87woi9rmft.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=35929@debbugs.gnu.org \
--cc=rob@vllmrt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).