hspec-expectations-lifted (empty) → 0.5.0
raw patch · 5 files changed
+119/−0 lines, 5 filesdep +basedep +hspecdep +hspec-expectationssetup-changed
Dependencies added: base, hspec, hspec-expectations, hspec-expectations-lifted, transformers
Files
- LICENSE +19/−0
- Setup.lhs +3/−0
- hspec-expectations-lifted.cabal +43/−0
- src/Test/Hspec/Expectations/Lifted.hs +53/−0
- test/Spec.hs +1/−0
+ LICENSE view
@@ -0,0 +1,19 @@+Copyright (c) 2011-2013 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+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in+all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+THE SOFTWARE.
+ Setup.lhs view
@@ -0,0 +1,3 @@+#!/usr/bin/env runhaskell+> import Distribution.Simple+> main = defaultMain
+ hspec-expectations-lifted.cabal view
@@ -0,0 +1,43 @@+name: hspec-expectations-lifted+version: 0.5.0+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+author: Simon Hengel <sol@typeful.net>+maintainer: Simon Hengel <sol@typeful.net>+build-type: Simple+category: Testing+cabal-version: >= 1.8++source-repository head+ type: git+ location: https://github.com/sol/hspec-expectations-lifted++library+ ghc-options:+ -Wall+ build-depends:+ base < 4.8+ , hspec-expectations >= 0.5+ , 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
@@ -0,0 +1,53 @@+-- |+-- Introductory documentation: <https://github.com/sol/hspec-expectations#readme>+module Test.Hspec.Expectations.Lifted (++-- * Setting expectations+ expectationFailure+, shouldBe+, shouldSatisfy+, shouldContain+, shouldMatchList+, shouldReturn+) where++import Control.Monad.IO.Class+import qualified Test.Hspec.Expectations as E++infix 1 `shouldBe`, `shouldSatisfy`, `shouldContain`, `shouldMatchList`, `shouldReturn`++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 = 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 ()+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 = liftIO2 E.shouldSatisfy++-- |+-- @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 ()+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 = 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)
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}