guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#35929] [PATCH] tests: hackage: avoid mock, and extract test data


From: Robert Vollmert
Subject: [bug#35929] [PATCH] tests: hackage: avoid mock, and extract test data
Date: Thu, 30 May 2019 13:42:33 +0200


> On 29. May 2019, at 23:16, Ludovic Courtès <address@hidden> wrote:
> --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—

Hmm, I can’t quite get this to work. I’d like to supply a name for
the pattern, so I can reuse it across test cases, and I’m currently
at a loss for how to do tha:

scheme@(ice-9 match)> (define pattern '(a b c))
scheme@(ice-9 match)> (match-pattern '(a 2) pattern)
$30 = #t

This makes sense, because the pattern is the literal pattern, not whatever
pattern would evaluate to.

I’ve also tried things like

scheme@(ice-9 match)> (define-syntax-rule (pattern) (a b c))

thinking that the pattern definition should happen at macro level, too,
but can’t get that to work either… Do you have further hints?

…

I did manage to get things to work using eval, will send a revised
patch.

Thanks,
Robert






reply via email to

[Prev in Thread] Current Thread [Next in Thread]