packages feed

hspec-expectations 0.3.2 → 0.3.3

raw patch · 2 files changed

+12/−2 lines, 2 files

Files

hspec-expectations.cabal view
@@ -1,5 +1,5 @@ name:             hspec-expectations-version:          0.3.2+version:          0.3.3 synopsis:         Catchy combinators for HUnit description:      Catchy combinators for HUnit: <https://github.com/sol/hspec-expectations#readme> license:          MIT
src/Test/Hspec/Expectations.hs view
@@ -7,6 +7,7 @@ , expectationFailure , shouldBe , shouldSatisfy+, shouldContain , shouldReturn  -- * Expecting exceptions@@ -39,6 +40,7 @@ import           Test.HUnit (Assertion, (@?=), assertBool, assertFailure) import           Control.Exception import           Data.Typeable+import           Data.List (isInfixOf)  type Expectation = Assertion @@ -60,6 +62,14 @@ v `shouldSatisfy` p = assertBool ("predicate failed on: " ++ show v) (p v)  -- |+-- @list \`shouldContain\` sublist@ sets the expectation that @sublist@ is contained,+-- wholly and intact, anywhere in the second.+shouldContain :: (Show a, Eq a) => [a] -> [a] -> Expectation+list `shouldContain` sublist = assertBool errorMsg (sublist `isInfixOf` list)+  where+    errorMsg = show list ++ " doesn't contain " ++ show sublist++-- | -- @action \`shouldReturn\` expected@ sets the expectation that @action@ -- returns @expected@. shouldReturn :: (Show a, Eq a) => IO a -> a -> Expectation@@ -89,7 +99,7 @@     exceptionType = (show . typeOf . instanceOf) p       where         instanceOf :: Selector a -> a-        instanceOf _ = error "Test.Hspec.Expectations.shouldThrow: brocken Typeable instance"+        instanceOf _ = error "Test.Hspec.Expectations.shouldThrow: broken Typeable instance"  anyException :: Selector SomeException anyException = const True