Cleanup
This commit is contained in:
parent
ca0b7156d8
commit
86d99239bb
@ -36,11 +36,11 @@ library
|
|||||||
, http-client == 0.4.*
|
, http-client == 0.4.*
|
||||||
, http-types == 0.9.*
|
, http-types == 0.9.*
|
||||||
, http-media == 0.6.*
|
, http-media == 0.6.*
|
||||||
, servant-client == 0.7.*
|
, servant-client > 0.6 && < 0.9
|
||||||
, servant-server == 0.7.*
|
, servant-server > 0.6 && < 0.9
|
||||||
, string-conversions == 0.4.*
|
, string-conversions == 0.4.*
|
||||||
, data-default-class == 0.0.*
|
, data-default-class == 0.0.*
|
||||||
, servant == 0.7.*
|
, servant > 0.6 && < 0.9
|
||||||
, warp >= 3.2.4 && < 3.3
|
, warp >= 3.2.4 && < 3.3
|
||||||
, process == 1.2.*
|
, process == 1.2.*
|
||||||
, temporary == 1.2.*
|
, temporary == 1.2.*
|
||||||
@ -68,6 +68,7 @@ library
|
|||||||
, OverloadedStrings
|
, OverloadedStrings
|
||||||
, FunctionalDependencies
|
, FunctionalDependencies
|
||||||
, NoImplicitPrelude
|
, NoImplicitPrelude
|
||||||
|
, AutoDeriveTypeable
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
test-suite spec
|
test-suite spec
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
module Servant.QuickCheck.Internal.Predicates where
|
module Servant.QuickCheck.Internal.Predicates where
|
||||||
|
|
||||||
import Control.Exception (SomeException, catch, throw)
|
import Control.Exception (catch, throw)
|
||||||
import Control.Monad (ap, guard, liftM2)
|
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Data.Aeson (Object, decode)
|
import Data.Aeson (Object, decode)
|
||||||
import Data.Bifunctor (Bifunctor (..))
|
|
||||||
import qualified Data.ByteString as SBS
|
import qualified Data.ByteString as SBS
|
||||||
import qualified Data.ByteString.Char8 as SBSC
|
import qualified Data.ByteString.Char8 as SBSC
|
||||||
import qualified Data.ByteString.Lazy as LBS
|
import qualified Data.ByteString.Lazy as LBS
|
||||||
@ -13,12 +11,10 @@ import Data.Either (isRight)
|
|||||||
import Data.List.Split (wordsBy)
|
import Data.List.Split (wordsBy)
|
||||||
import Data.Maybe (fromMaybe, isJust)
|
import Data.Maybe (fromMaybe, isJust)
|
||||||
import Data.Monoid ((<>))
|
import Data.Monoid ((<>))
|
||||||
import Data.Text (Text)
|
|
||||||
import GHC.Generics (Generic)
|
import GHC.Generics (Generic)
|
||||||
import Network.HTTP.Client (Manager, Request, Response, httpLbs,
|
import Network.HTTP.Client (Manager, Request, Response, httpLbs,
|
||||||
method, parseUrl, requestHeaders,
|
method, requestHeaders, responseBody,
|
||||||
responseBody, responseHeaders,
|
responseHeaders, parseUrl, responseStatus)
|
||||||
responseStatus)
|
|
||||||
import Network.HTTP.Media (matchAccept)
|
import Network.HTTP.Media (matchAccept)
|
||||||
import Network.HTTP.Types (methodGet, methodHead, parseMethod,
|
import Network.HTTP.Types (methodGet, methodHead, parseMethod,
|
||||||
renderStdMethod, status100, status200,
|
renderStdMethod, status100, status200,
|
||||||
@ -134,7 +130,7 @@ notAllowedContainsAllowHeader
|
|||||||
| m <- [minBound .. maxBound ]
|
| m <- [minBound .. maxBound ]
|
||||||
, renderStdMethod m /= method req ]
|
, renderStdMethod m /= method req ]
|
||||||
case filter pred' resp of
|
case filter pred' resp of
|
||||||
(x:xs) -> throw $ PredicateFailure "notAllowedContainsAllowHeader" (Just req) x
|
(x:_) -> throw $ PredicateFailure "notAllowedContainsAllowHeader" (Just req) x
|
||||||
[] -> return resp
|
[] -> return resp
|
||||||
where
|
where
|
||||||
pred' resp = responseStatus resp == status405 && not (hasValidHeader "Allow" go resp)
|
pred' resp = responseStatus resp == status405 && not (hasValidHeader "Allow" go resp)
|
||||||
|
|||||||
@ -5,9 +5,6 @@ import Control.Concurrent (modifyMVar_, newMVar, readMVar)
|
|||||||
import Control.Monad (unless)
|
import Control.Monad (unless)
|
||||||
import qualified Data.ByteString.Lazy as LBS
|
import qualified Data.ByteString.Lazy as LBS
|
||||||
import Data.Proxy (Proxy)
|
import Data.Proxy (Proxy)
|
||||||
import Data.String (IsString (..))
|
|
||||||
import Data.Text (Text)
|
|
||||||
import GHC.Generics (Generic)
|
|
||||||
import qualified Network.HTTP.Client as C
|
import qualified Network.HTTP.Client as C
|
||||||
import Network.Wai.Handler.Warp (withApplication)
|
import Network.Wai.Handler.Warp (withApplication)
|
||||||
import Prelude.Compat
|
import Prelude.Compat
|
||||||
@ -87,7 +84,7 @@ serversEqual api burl1 burl2 args req = do
|
|||||||
assert False
|
assert False
|
||||||
case r of
|
case r of
|
||||||
Success {} -> return ()
|
Success {} -> return ()
|
||||||
f@Failure{..} -> readMVar deetsMVar >>= \x -> expectationFailure $
|
Failure{..} -> readMVar deetsMVar >>= \x -> expectationFailure $
|
||||||
"Failed:\n" ++ show x
|
"Failed:\n" ++ show x
|
||||||
GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
|
GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
|
||||||
NoExpectedFailure {} -> expectationFailure $ "No expected failure"
|
NoExpectedFailure {} -> expectationFailure $ "No expected failure"
|
||||||
@ -121,11 +118,11 @@ serverSatisfies api burl args preds = do
|
|||||||
v <- run $ finishPredicates preds (noCheckStatus req) defManager
|
v <- run $ finishPredicates preds (noCheckStatus req) defManager
|
||||||
run $ modifyMVar_ deetsMVar $ const $ return v
|
run $ modifyMVar_ deetsMVar $ const $ return v
|
||||||
case v of
|
case v of
|
||||||
Just x -> assert False
|
Just _ -> assert False
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
case r of
|
case r of
|
||||||
Success {} -> return ()
|
Success {} -> return ()
|
||||||
f@Failure{..} -> readMVar deetsMVar >>= \x -> expectationFailure $
|
Failure{..} -> readMVar deetsMVar >>= \x -> expectationFailure $
|
||||||
"Failed:\n" ++ show x
|
"Failed:\n" ++ show x
|
||||||
GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
|
GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
|
||||||
NoExpectedFailure {} -> expectationFailure $ "No expected failure"
|
NoExpectedFailure {} -> expectationFailure $ "No expected failure"
|
||||||
|
|||||||
@ -7,9 +7,9 @@ packages:
|
|||||||
|
|
||||||
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
|
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- servant-0.7
|
- servant-0.8
|
||||||
- servant-client-0.7
|
- servant-client-0.8
|
||||||
- servant-server-0.7
|
- servant-server-0.8
|
||||||
|
|
||||||
# Override default flag values for local packages and extra-deps
|
# Override default flag values for local packages and extra-deps
|
||||||
flags: {}
|
flags: {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user