-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
forAll :: ∀ e a f. Foldable f => (a -> String) -> String -> f a -> (a -> Aff e Unit) -> Spec e Unit #49
Comments
I was looking for something like this to write a tests that takes a record
of functions that work against a database, and a record of the same type
with fakes, making sure both behave the same in the test.
…On Tue, Apr 25, 2017 at 10:24 PM, Felix Schlitter ***@***.***> wrote:
I would welcome utility functions like these as I have been re-inventing
that wheel many
<https://github.com/felixSchl/neodoc/blob/development/test/Test/Spec/SolveSpec.purs#L240>
times
<https://github.com/felixSchl/neodoc/blob/development/test/Test/Spec/DescParserSpec.purs#L58>
over
<https://github.com/felixSchl/neodoc/blob/development/test/Test/Spec/ArgParserSpec.purs#L974>
for neodoc
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#49 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAK7uOLsTKOtE7xPrUJuIcrwvaoq_hWDks5rzmSigaJpZM4NH69o>
.
|
Yeah, this does seem useful. I have some questions/considerations:
Thanks for the suggestion! |
so at this point it looks like: they :: ∀ e a f. Foldable f => (a -> String) -> f a -> (a -> Aff e Unit) -> Aff e Unit
they itTitle arb f = for_ arb \a -> it (itTitle a) (f a)
...
describe "format (unformat a) = a" do
they show arb \(str) -> (format $ unformat str) `shouldEqual` (Right str)
... About order: I don't have strong opinion on it, but If we leave
|
Yeah, I could not come with any specific order either, as it doesn't read naturally anyway. I think we should go with what you already have: they :: ∀ e a f. Foldable f => (a -> String) -> f a -> (a -> Aff e Unit) -> Aff e Unit Would you like to submit this as a PR? |
Yes! |
What are thoughts on adding something like this this?
I have been using
for_
init
block but if some test case fails then other items are not tested and you can't see them in log. using this function you can see each item in log and all of them will be executed.The text was updated successfully, but these errors were encountered: