genvalidity-hspec 0.6.1.0 → 0.6.1.1
raw patch · 2 files changed
+13/−3 lines, 2 filesdep +transformers
Dependencies added: transformers
Files
- genvalidity-hspec.cabal +3/−2
- src/Test/Validity/Utils.hs +10/−1
genvalidity-hspec.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 963ec860fbcd5ff6bc1148b8abc7c91d1bf7a7ef77e0ed0181ffc136b6e37005+-- hash: 6fe4772b4a007d5e358a91f2500b29b0161e709fcfceb3e14c58240fffa9d8e7 name: genvalidity-hspec-version: 0.6.1.0+version: 0.6.1.1 synopsis: Standard spec's for GenValidity instances description: Note: There are companion packages for this library: .@@ -42,6 +42,7 @@ , genvalidity-property >=0.2 , hspec , hspec-core+ , transformers , validity >=0.5 exposed-modules: Test.Validity
src/Test/Validity/Utils.hs view
@@ -19,6 +19,9 @@ , shouldBeInvalid ) where +import Control.Monad.Trans.Writer (mapWriterT)+import Control.Arrow (second)+ import Data.Data import Test.Hspec@@ -58,12 +61,18 @@ instance Functor Anon where fmap f (Anon a) = Anon (f a) +-- I'm not sure why mapSpecTree was removed from hspec-core,+-- but it has been copied here for convenience.+-- https://github.com/hspec/hspec/commit/020c7ecc4a73c24af38e9fab049f60bb9aec6981#diff-29cb22f0ef6e98086a71fc045847bd21L22+mapSpecTree' :: (SpecTree a -> SpecTree b) -> SpecM a r -> SpecM b r+mapSpecTree' f (SpecM specs) = SpecM (mapWriterT (fmap (second (map f))) specs)+ -- | Asserts that a given 'Spec' tree fails _somewhere_. -- -- It also shows the given string when reporting that the tree unexpectedly -- succeeded. failsBecause :: String -> SpecWith () -> SpecWith ()-failsBecause s = mapSpecTree go+failsBecause s = mapSpecTree' go where go :: SpecTree () -> SpecTree () go sp =