benri-hspec 0.1.0.1 → 0.1.0.2
raw patch · 3 files changed
+24/−19 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- benri-hspec.cabal +2/−2
- src/Test/Hspec/Benri.hs +18/−17
ChangeLog.md view
@@ -2,6 +2,10 @@ `benri-hspec` uses [PVP Versioning][1]. +## 0.1.0.2 -- 2024-02-28++* Reformated, enabled doctests by default+ ## 0.1.0.1 -- 2022-12-23
benri-hspec.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: benri-hspec-version: 0.1.0.1+version: 0.1.0.2 synopsis: Simplify tests where Either or Maybe types are returned from monadic code description: A small library of __convenient__ functions for writing hspec tests.@@ -61,7 +61,7 @@ Flag use-doc-tests description: Include the doctests in the package tests- default: False+ default: True test-suite doctests if flag(use-doc-tests)
src/Test/Hspec/Benri.hs view
@@ -7,21 +7,22 @@ Provides \convenient\ functions for writing hspec tests where test values are returned from a monad. -}-module Test.Hspec.Benri (- -- * match a predicate- endsThen,+module Test.Hspec.Benri+ ( -- * match a predicate+ endsThen - -- * @Maybe@ values- endsJust,- endsJust_,- endsNothing,+ -- * @Maybe@ values+ , endsJust+ , endsJust_+ , endsNothing - -- * @Either@ values- endsLeft,- endsLeft_,- endsRight,- endsRight_,-) where+ -- * @Either@ values+ , endsLeft+ , endsLeft_+ , endsRight+ , endsRight_+ )+where import Data.Maybe (isJust) import Test.Hspec (Expectation, HasCallStack, shouldBe, shouldSatisfy)@@ -51,8 +52,8 @@ >>> pure (readEither "not an int" :: Either String Int) `endsLeft` "Prelude.read: no parse" -}-endsLeft ::- (HasCallStack, Show a, Eq a, Show b, Eq b) => IO (Either a b) -> a -> Expectation+endsLeft+ :: (HasCallStack, Show a, Eq a, Show b, Eq b) => IO (Either a b) -> a -> Expectation action `endsLeft` expected = action >>= (`shouldBe` Left expected) @@ -83,8 +84,8 @@ >>> pure (readMaybe "1" :: Maybe Int) `endsJust` 1 -}-endsJust ::- (HasCallStack, Show a, Eq a) => IO (Maybe a) -> a -> Expectation+endsJust+ :: (HasCallStack, Show a, Eq a) => IO (Maybe a) -> a -> Expectation action `endsJust` expected = action >>= (`shouldBe` Just expected)