wai-test 2.0.0.2 → 2.0.1
raw patch · 2 files changed
+17/−5 lines, 2 filesdep +deepseqdep −HUnit
Dependencies added: deepseq
Dependencies removed: HUnit
Files
- Network/Wai/Test.hs +15/−3
- wai-test.cabal +2/−2
Network/Wai/Test.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-} module Network.Wai.Test ( -- * Session Session@@ -19,13 +20,17 @@ , assertBodyContains , assertHeader , assertNoHeader+ , WaiTestFailure (..) ) where import Network.Wai-import qualified Test.HUnit.Base as H import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.State (StateT, evalStateT) import Control.Monad.Trans.Reader (ReaderT, runReaderT, ask)+import Control.Monad (unless)+import Control.DeepSeq (deepseq)+import Control.Exception (throwIO, Exception)+import Data.Typeable (Typeable) import Data.Map (Map) import qualified Data.Map as Map import Data.ByteString (ByteString)@@ -108,10 +113,17 @@ toBuilder C.Flush = flush assertBool :: String -> Bool -> Session ()-assertBool s b = liftIO $ H.assertBool s b+assertBool s b = unless b $ assertFailure s assertString :: String -> Session ()-assertString s = liftIO $ H.assertString s+assertString s = unless (null s) $ assertFailure s++assertFailure :: String -> Session ()+assertFailure msg = msg `deepseq` liftIO (throwIO (WaiTestFailure msg))++data WaiTestFailure = WaiTestFailure String+ deriving (Show, Eq, Typeable)+instance Exception WaiTestFailure assertContentType :: ByteString -> SResponse -> Session () assertContentType ct SResponse{simpleHeaders = h} =
wai-test.cabal view
@@ -1,5 +1,5 @@ name: wai-test-version: 2.0.0.2+version: 2.0.1 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -23,10 +23,10 @@ , conduit >= 0.5 && < 1.1 , blaze-builder-conduit >= 0.5 && < 1.1 , cookie >= 0.2 && < 0.5- , HUnit >= 1.2 && < 1.3 , http-types >= 0.7 , case-insensitive >= 0.2 , network+ , deepseq exposed-modules: Network.Wai.Test ghc-options: -Wall