@@ -17,8 +17,8 @@ import qualified Text.Blaze.Html as Blaze
1717import qualified Text.Blaze.Html5 as Blaze5
1818import Test.Hspec (Spec, context, describe, it, shouldBe,
1919 shouldContain)
20−import Test.Hspec.Core.Spec (Arg, Example, Result (..),
21− defaultParams)
20+import Test.Hspec.Core.Spec (Arg, Example, Result (..), ResultStatus (..),
21+ defaultParams, safeEvaluateExample)
2222import Test.QuickCheck.Gen (generate, unGen)
2323import Test.QuickCheck.Random (mkQCGen)
2424
@@ -30,13 +30,6 @@ import Servant.API.Internal.Test.ComprehensiveAPI (ComprehensiveAPI,
3030 comprehensiveAPI)
3131#endif
3232
33−#if MIN_VERSION_hspec(2,4,0)
34−import Test.Hspec.Core.Spec (safeEvaluateExample)
35−#else
36−import Control.Exception (try)
37−import Test.Hspec.Core.Spec (evaluateExample)
38−#endif
39−
4033import Servant.QuickCheck
4134import Servant.QuickCheck.Internal (genRequest, runGenRequest,
4235 serverDoesntSatisfy)
@@ -349,27 +342,14 @@ ctx = BasicAuthCheck (const . return $ NoSuchUser) :. EmptyContext
349342-- Utils
350343------------------------------------------------------------------------------
351344evalExample :: (Example e, Arg e ~ ()) => e -> IO EvalResult
352−#if MIN_VERSION_hspec(2,4,0)
353345evalExample e = do
354346 r <- safeEvaluateExample e defaultParams ($ ()) progCallback
355− case r of
356− Left err -> return $ AnException err
357− Right Success -> return $ AllGood
358− Right (Failure _ reason) -> return $ FailedWith $ show reason
359− Right (Pending _) -> error "should not happen"
360− where
361− progCallback _ = return ()
362−#else
363−evalExample e = do
364− r <- try $ evaluateExample e defaultParams ($ ()) progCallback
365− case r of
366− Left err -> return $ AnException err
367− Right Success -> return $ AllGood
368− Right (Fail _ reason) -> return $ FailedWith reason
369− Right (Pending _) -> error "should not happen"
347+ case resultStatus r of
348+ Success -> return $ AllGood
349+ Failure _ reason -> return $ FailedWith $ show reason
350+ Pending {} -> error "should not happen"
370351 where
371352 progCallback _ = return ()
372−#endif
373353
374354data EvalResult
375355 = AnException SomeException