git.iko.soy/servant-quickcheck
on master help sign in
Cleanup
86d9923Julian K. Arni
servant-quickcheck.cabal+4−3
@@ -36,11 +36,11 @@ library
36 , http-client == 0.4.*
36 , http-client == 0.4.*
37 , http-types == 0.9.*
37 , http-types == 0.9.*
38 , http-media == 0.6.*
38 , http-media == 0.6.*
39− , servant-client == 0.7.*
39+ , servant-client > 0.6 && < 0.9
40− , servant-server == 0.7.*
40+ , servant-server > 0.6 && < 0.9
41 , string-conversions == 0.4.*
41 , string-conversions == 0.4.*
42 , data-default-class == 0.0.*
42 , data-default-class == 0.0.*
43− , servant == 0.7.*
43+ , servant > 0.6 && < 0.9
44 , warp >= 3.2.4 && < 3.3
44 , warp >= 3.2.4 && < 3.3
45 , process == 1.2.*
45 , process == 1.2.*
46 , temporary == 1.2.*
46 , temporary == 1.2.*
@@ -68,6 +68,7 @@ library
68 , OverloadedStrings
68 , OverloadedStrings
69 , FunctionalDependencies
69 , FunctionalDependencies
70 , NoImplicitPrelude
70 , NoImplicitPrelude
71+ , AutoDeriveTypeable
71 default-language: Haskell2010
72 default-language: Haskell2010
72
73
73test-suite spec
74test-suite spec
src/Servant/QuickCheck/Internal/Predicates.hs+4−8
@@ -1,10 +1,8 @@
1module Servant.QuickCheck.Internal.Predicates where
1module Servant.QuickCheck.Internal.Predicates where
2
2
3−import Control.Exception (SomeException, catch, throw)
3+import Control.Exception (catch, throw)
4−import Control.Monad (ap, guard, liftM2)
5import Control.Monad.Reader
4import Control.Monad.Reader
6import Data.Aeson (Object, decode)
5import Data.Aeson (Object, decode)
7−import Data.Bifunctor (Bifunctor (..))
8import qualified Data.ByteString as SBS
6import qualified Data.ByteString as SBS
9import qualified Data.ByteString.Char8 as SBSC
7import qualified Data.ByteString.Char8 as SBSC
10import qualified Data.ByteString.Lazy as LBS
8import qualified Data.ByteString.Lazy as LBS
@@ -13,12 +11,10 @@ import Data.Either (isRight)
13import Data.List.Split (wordsBy)
11import Data.List.Split (wordsBy)
14import Data.Maybe (fromMaybe, isJust)
12import Data.Maybe (fromMaybe, isJust)
15import Data.Monoid ((<>))
13import Data.Monoid ((<>))
16−import Data.Text (Text)
17import GHC.Generics (Generic)
14import GHC.Generics (Generic)
18import Network.HTTP.Client (Manager, Request, Response, httpLbs,
15import Network.HTTP.Client (Manager, Request, Response, httpLbs,
19− method, parseUrl, requestHeaders,
16+ method, requestHeaders, responseBody,
20− responseBody, responseHeaders,
21− responseStatus)
17+ responseHeaders, parseUrl, responseStatus)
22import Network.HTTP.Media (matchAccept)
18import Network.HTTP.Media (matchAccept)
23import Network.HTTP.Types (methodGet, methodHead, parseMethod,
19import Network.HTTP.Types (methodGet, methodHead, parseMethod,
24 renderStdMethod, status100, status200,
20 renderStdMethod, status100, status200,
@@ -134,7 +130,7 @@ notAllowedContainsAllowHeader
134 | m <- [minBound .. maxBound ]
130 | m <- [minBound .. maxBound ]
135 , renderStdMethod m /= method req ]
131 , renderStdMethod m /= method req ]
136 case filter pred' resp of
132 case filter pred' resp of
137− (x:xs) -> throw $ PredicateFailure "notAllowedContainsAllowHeader" (Just req) x
133+ (x:_) -> throw $ PredicateFailure "notAllowedContainsAllowHeader" (Just req) x
138 [] -> return resp
134 [] -> return resp
139 where
135 where
140 pred' resp = responseStatus resp == status405 && not (hasValidHeader "Allow" go resp)
136 pred' resp = responseStatus resp == status405 && not (hasValidHeader "Allow" go resp)
src/Servant/QuickCheck/Internal/QuickCheck.hs+3−6
@@ -5,9 +5,6 @@ import Control.Concurrent (modifyMVar_, newMVar, readMVar)
5import Control.Monad (unless)
5import Control.Monad (unless)
6import qualified Data.ByteString.Lazy as LBS
6import qualified Data.ByteString.Lazy as LBS
7import Data.Proxy (Proxy)
7import Data.Proxy (Proxy)
8−import Data.String (IsString (..))
9−import Data.Text (Text)
10−import GHC.Generics (Generic)
11import qualified Network.HTTP.Client as C
8import qualified Network.HTTP.Client as C
12import Network.Wai.Handler.Warp (withApplication)
9import Network.Wai.Handler.Warp (withApplication)
13import Prelude.Compat
10import Prelude.Compat
@@ -87,7 +84,7 @@ serversEqual api burl1 burl2 args req = do
87 assert False
84 assert False
88 case r of
85 case r of
89 Success {} -> return ()
86 Success {} -> return ()
90− f@Failure{..} -> readMVar deetsMVar >>= \x -> expectationFailure $
87+ Failure{..} -> readMVar deetsMVar >>= \x -> expectationFailure $
91 "Failed:\n" ++ show x
88 "Failed:\n" ++ show x
92 GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
89 GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
93 NoExpectedFailure {} -> expectationFailure $ "No expected failure"
90 NoExpectedFailure {} -> expectationFailure $ "No expected failure"
@@ -121,11 +118,11 @@ serverSatisfies api burl args preds = do
121 v <- run $ finishPredicates preds (noCheckStatus req) defManager
118 v <- run $ finishPredicates preds (noCheckStatus req) defManager
122 run $ modifyMVar_ deetsMVar $ const $ return v
119 run $ modifyMVar_ deetsMVar $ const $ return v
123 case v of
120 case v of
124− Just x -> assert False
121+ Just _ -> assert False
125 _ -> return ()
122 _ -> return ()
126 case r of
123 case r of
127 Success {} -> return ()
124 Success {} -> return ()
128− f@Failure{..} -> readMVar deetsMVar >>= \x -> expectationFailure $
125+ Failure{..} -> readMVar deetsMVar >>= \x -> expectationFailure $
129 "Failed:\n" ++ show x
126 "Failed:\n" ++ show x
130 GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
127 GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
131 NoExpectedFailure {} -> expectationFailure $ "No expected failure"
128 NoExpectedFailure {} -> expectationFailure $ "No expected failure"
stack.yaml+3−3
@@ -7,9 +7,9 @@ packages:
7
7
8# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
8# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
9extra-deps:
9extra-deps:
10−- servant-0.7
10+- servant-0.8
11−- servant-client-0.7
11+- servant-client-0.8
12−- servant-server-0.7
12+- servant-server-0.8
13
13
14# Override default flag values for local packages and extra-deps
14# Override default flag values for local packages and extra-deps
15flags: {}
15flags: {}