hspec-expectations-lifted 0.5.0 → 0.8.2
raw patch · 4 files changed
+64/−34 lines, 4 filesdep −hspecdep −hspec-expectations-lifteddep ~basedep ~hspec-expectations
Dependencies removed: hspec, hspec-expectations-lifted
Dependency ranges changed: base, hspec-expectations
Files
- LICENSE +1/−1
- hspec-expectations-lifted.cabal +5/−20
- src/Test/Hspec/Expectations/Lifted.hs +58/−12
- test/Spec.hs +0/−1
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2011-2013 Simon Hengel <sol@typeful.net>+Copyright (c) 2011-2016 Simon Hengel <sol@typeful.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
hspec-expectations-lifted.cabal view
@@ -1,10 +1,10 @@ name: hspec-expectations-lifted-version: 0.5.0+version: 0.8.2 synopsis: A version of hspec-expectations generalized to MonadIO description: A version of hspec-expectations generalized to MonadIO license: MIT license-file: LICENSE-copyright: (c) 2011-2013 Simon Hengel+copyright: (c) 2011-2016 Simon Hengel author: Simon Hengel <sol@typeful.net> maintainer: Simon Hengel <sol@typeful.net> build-type: Simple@@ -13,31 +13,16 @@ source-repository head type: git- location: https://github.com/sol/hspec-expectations-lifted+ location: https://github.com/hspec/hspec-expectations-lifted library ghc-options: -Wall build-depends:- base < 4.8- , hspec-expectations >= 0.5+ base == 4.*+ , hspec-expectations >= 0.8.2 , transformers hs-source-dirs: src exposed-modules: Test.Hspec.Expectations.Lifted--test-suite spec- main-is:- Spec.hs- type:- exitcode-stdio-1.0- ghc-options:- -Wall -Werror- hs-source-dirs:- src- , test- build-depends:- base- , hspec >= 1.3- , hspec-expectations-lifted
src/Test/Hspec/Expectations/Lifted.hs view
@@ -1,53 +1,99 @@+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ConstraintKinds #-} -- |--- Introductory documentation: <https://github.com/sol/hspec-expectations#readme>+-- Introductory documentation: <https://github.com/hspec/hspec-expectations#readme> module Test.Hspec.Expectations.Lifted ( -- * Setting expectations expectationFailure , shouldBe , shouldSatisfy+, shouldStartWith+, shouldEndWith , shouldContain , shouldMatchList , shouldReturn++, shouldNotBe+, shouldNotSatisfy+, shouldNotContain+, shouldNotReturn++-- * Re-exports+, HasCallStack ) where import Control.Monad.IO.Class import qualified Test.Hspec.Expectations as E+import Test.Hspec.Expectations (HasCallStack) -infix 1 `shouldBe`, `shouldSatisfy`, `shouldContain`, `shouldMatchList`, `shouldReturn`+infix 1 `shouldBe`, `shouldSatisfy`, `shouldStartWith`, `shouldEndWith`, `shouldContain`, `shouldMatchList`, `shouldReturn`+infix 1 `shouldNotBe`, `shouldNotSatisfy`, `shouldNotContain`, `shouldNotReturn` liftIO2 :: MonadIO m => (a -> b -> IO r) -> a -> b -> m r liftIO2 action a = liftIO . action a --- | This is just an alias for HUnit's `assertFailure`.-expectationFailure :: MonadIO m => String -> m ()+expectationFailure :: (HasCallStack, MonadIO m) => String -> m () expectationFailure = liftIO . E.expectationFailure -- | -- @actual \`shouldBe\` expected@ sets the expectation that @actual@ is equal--- to @expected@ (this is just an alias for `@?=`).-shouldBe :: (Show a, Eq a, MonadIO m) => a -> a -> m ()+-- to @expected@.+shouldBe :: (HasCallStack, MonadIO m, Show a, Eq a) => a -> a -> m () shouldBe = liftIO2 E.shouldBe -- | -- @v \`shouldSatisfy\` p@ sets the expectation that @p v@ is @True@.-shouldSatisfy :: (Show a, MonadIO m) => a -> (a -> Bool) -> m ()+shouldSatisfy :: (HasCallStack, MonadIO m, Show a) => a -> (a -> Bool) -> m () shouldSatisfy = liftIO2 E.shouldSatisfy -- |+-- @list \`shouldStartWith\` prefix@ sets the expectation that @list@ starts with @prefix@,+shouldStartWith :: (HasCallStack, MonadIO m, Show a, Eq a) => [a] -> [a] -> m ()+shouldStartWith = liftIO2 E.shouldStartWith++-- |+-- @list \`shouldEndWith\` suffix@ sets the expectation that @list@ ends with @suffix@,+shouldEndWith :: (HasCallStack, MonadIO m, Show a, Eq a) => [a] -> [a] -> m ()+shouldEndWith = liftIO2 E.shouldEndWith++-- | -- @list \`shouldContain\` sublist@ sets the expectation that @sublist@ is contained,--- wholly and intact, anywhere in the second.-shouldContain :: (Show a, Eq a, MonadIO m) => [a] -> [a] -> m ()+-- wholly and intact, anywhere in @list@.+shouldContain :: (HasCallStack, MonadIO m, Show a, Eq a) => [a] -> [a] -> m () shouldContain = liftIO2 E.shouldContain -- | -- @xs \`shouldMatchList\` ys@ sets the expectation that @xs@ has the same -- elements that @ys@ has, possibly in another order-shouldMatchList :: (Show a, Eq a, MonadIO m) => [a] -> [a] -> m ()+shouldMatchList :: (HasCallStack, MonadIO m, Show a, Eq a) => [a] -> [a] -> m () shouldMatchList = liftIO2 E.shouldMatchList -- | -- @action \`shouldReturn\` expected@ sets the expectation that @action@ -- returns @expected@.-shouldReturn :: (Show a, Eq a, MonadIO m) => m a -> a -> m ()-action `shouldReturn` expected = action >>= liftIO . (`E.shouldBe` expected)+shouldReturn :: (HasCallStack, MonadIO m, Show a, Eq a) => IO a -> a -> m ()+shouldReturn = liftIO2 E.shouldReturn++-- |+-- @actual \`shouldNotBe\` notExpected@ sets the expectation that @actual@ is not+-- equal to @notExpected@+shouldNotBe :: (HasCallStack, MonadIO m, Show a, Eq a) => a -> a -> m ()+shouldNotBe = liftIO2 E.shouldNotBe++-- |+-- @v \`shouldNotSatisfy\` p@ sets the expectation that @p v@ is @False@.+shouldNotSatisfy :: (HasCallStack, MonadIO m, Show a) => a -> (a -> Bool) -> m ()+shouldNotSatisfy = liftIO2 E.shouldNotSatisfy++-- |+-- @list \`shouldNotContain\` sublist@ sets the expectation that @sublist@ is not+-- contained anywhere in @list@.+shouldNotContain :: (HasCallStack, MonadIO m, Show a, Eq a) => [a] -> [a] -> m ()+shouldNotContain = liftIO2 E.shouldNotContain++-- |+-- @action \`shouldNotReturn\` notExpected@ sets the expectation that @action@+-- does not return @notExpected@.+shouldNotReturn :: (HasCallStack, MonadIO m, Show a, Eq a) => IO a -> a -> m ()+shouldNotReturn = liftIO2 E.shouldNotReturn
− test/Spec.hs
@@ -1,1 +0,0 @@-{-# OPTIONS_GHC -F -pgmF hspec-discover #-}