fix exception test

This commit is contained in:
Mark Wotton 2016-03-21 12:34:38 -04:00
parent df6834a335
commit 62961ef931
2 changed files with 6 additions and 4 deletions

View File

@ -21,7 +21,7 @@ import Control.Applicative
import Network.Wai (pathInfo, requestHeaders) import Network.Wai (pathInfo, requestHeaders)
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe)
import Data.Either (isLeft) import Data.Either (isLeft)
import Control.Monad.Catch (try) import Control.Exception.Lifted(try, SomeException)
import Data.ByteString.Lazy.Char8 () import Data.ByteString.Lazy.Char8 ()
import qualified Data.Map as Map import qualified Data.Map as Map
@ -234,9 +234,11 @@ main = hspec $ do
yit "throws an exception when no redirect was returned" $ do yit "throws an exception when no redirect was returned" $ do
get ("/" :: Text) get ("/" :: Text)
statusIs 200 statusIs 200
r <- followRedirect -- This appears to be an HUnitFailure, which is not
-- exported, so I'm catching SomeException instead.
(r :: Either SomeException ()) <- try followRedirect
statusIs 200 statusIs 200
-- assertBool "expected exception" $ isLeft r liftIO $ assertBool "expected exception" $ isLeft r
instance RenderMessage LiteApp FormMessage where instance RenderMessage LiteApp FormMessage where
renderMessage _ _ = defaultFormMessage renderMessage _ _ = defaultFormMessage

View File

@ -60,7 +60,7 @@ test-suite test
, yesod-form , yesod-form
, text , text
, wai , wai
, exceptions , lifted-base
, http-types , http-types
source-repository head source-repository head