testament icon indicating copy to clipboard operation
testament copied to clipboard

Feature: `each-is`

Open subsetpark opened this issue 4 years ago • 5 comments

Add a new macro, each-is:

each-is forms &opt note

forms should be a tuple or array of assertion forms, of the same kind understood by is.

(each-is @[foo bar baz] "note") is equivalent to:

(is foo "note")
(is bar "note")
(is baz "note")

original issue text:

(is @[foo bar baz] note) would be equivalent to (is foo note) (is bar note) ...

subsetpark avatar Aug 11 '21 14:08 subsetpark

Would it be better to have a separate are macro for this? While this looks helpful in the abstract, it also seems to confuse the semantics of is. To be clear, it doesn't have to be are and could be something that makes the relationship to is clearer (e.g. is-multi, is-group, iss, etc).

pyrmont avatar Aug 12 '21 05:08 pyrmont

Yeah, I think that’s right. I’m not a fan of those bdd-style libraries that try to give you an English word for everything you might want to say, but the aim of keeping a simple and consistent semantics for the function itself is quite worthwhile.

subsetpark avatar Aug 12 '21 15:08 subsetpark

Yeah, I'm similar. I'm a worried that are is a little too clever by half. I didn't really like the other alternatives, though. If it was a separate macro, do you have a name you'd prefer? is-all? is-every?

pyrmont avatar Aug 13 '21 01:08 pyrmont

each-is maybe? each is already a word

subsetpark avatar Aug 13 '21 23:08 subsetpark

That one sounds good to me: clear and easy to understand.

pyrmont avatar Aug 17 '21 05:08 pyrmont