-
Notifications
You must be signed in to change notification settings - Fork 25
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
A few more expectations #35
Comments
@declension Sorry for the late reply! I'm somewhat conservative with adding stuff to If you want to create a separate package, say BTW, I would like to see the type signatures of |
Great, thanks @sol and no worries! I'm more than happy with the Anyway I've dug out some of that code and will try to tidy a bit. Here are some ideas shouldExceed :: (HasCallStack, Show a, Ord a) => a -> a -> Expectation
shouldExceed = shouldBeGreaterThan
shouldBeGreaterThan :: (HasCallStack, Show a, Ord a) => a -> a -> Expectation
shouldBeLessThan :: (HasCallStack, Show a, Ord a) => a -> a -> Expectation Updated version of shouldInclude :: (HasCallStack, Show a, Eq a, Foldable t, Show (t a))
=> t a
-> a
-> Expectation Debatable if this one is useful, but can produce nicer error messages, and sometimes you don't want to specify the shouldExist :: (HasCallStack, Show a) => String -> Maybe a -> Expectation |
@sol should I push a PR to see some code? |
* Add a new `shouldInclude` (hspec#38 / hspec#35) * Also, a more general `shouldIncludeAll` which tests provides subset-like expectations (generalised to any `Foldable`s), with helpful (hopefully) messaging about missing elements * Replicate a few unexported helper functions, rather than mess with the overall structure * Add some tests around these * Update Hpack / Cabal Closes hspec#38
* Add a new `shouldInclude` (hspec#38 / hspec#35) * Also, a more general `shouldIncludeAll` which tests provides subset-like expectations (generalised to any `Foldable`s), with helpful (hopefully) messaging about missing elements * Replicate a few unexported helper functions, rather than mess with the overall structure * Add some tests around these * Update Hpack / Cabal Closes hspec#38
* Add a new `shouldInclude` (hspec#38 / hspec#35) * Also, a more general `shouldIncludeAll` which provides subset-like expectations (generalised to any `Foldable`s), with helpful (hopefully) messaging about missing elements * Add some tests around these * Replicate a few unexported helper functions, rather than mess with the overall structure * Update Hpack / Cabal Closes hspec#38
First of all - thanks for Hspec, it's great! Really useful both in and out of work.
I've got a few small helper expectations (e.g.
shouldExceed
,shouldInclude
,shouldExist
) that increasingly I / we're using to help with descriptive failures (and extra readable tests especially for beginners).Is this codebase taking PRs, or would you prefer these be published elsewhere / kept private?
The text was updated successfully, but these errors were encountered: