packages feed

servant-quickcheck 0.0.1.1 → 0.0.2.0

raw patch · 6 files changed

+75/−20 lines, 6 filesdep ~basedep ~data-default-classdep ~http-client

Dependency ranges changed: base, data-default-class, http-client, process

Files

− CHANGELOG.md
@@ -1,10 +0,0 @@-# 0.0.1.1--- Exclude GHC 7.8 base (it wasn't properly supported anyhow).-- More generous bounds for other packages.--# 0.0.1.0--- Better error messages. Error messages now contain failing predicate, failing-response and (except for response predicates), failing requests.-- Significant changes to RequestPredicate and ResponsePredicate types.
+ CHANGELOG.yaml view
@@ -0,0 +1,46 @@+upcoming:++releases:++  - version: "0.0.2.0"+    changes:++      - description: Update CHANGELOG to YAML syntax.+        pr: 16+        authors: jkarni+        date: 2016-09-14++      - description: Support new CaptureAll combinator+        pr: 16+        authors: jkarni+        date: 2016-09-14++      - description: Support GHC 8+        pr: 16+        authors: jkarni+        date: 2016-09-14++  - version: "0.0.1.1"+    changes:++      - description: Exclude GHC 7.8 (by bumping base lower bound to 4.8)+        pr: none+        authors: jkarni++      - description: More generous bounds for other packages.+        pr: none+        authors: jkarni++  - version: "0.0.1.0"+    changes:++      - description: Better error messages.+        notes: >+          Error messages now contain failing predicate, failing response and+          (except for response predicates), failing requests.+        pr: none+        authors: jkarni++      - description: Signicant changes to RequestPredicate and ResponsePredicate types.+        pr: none+        authors: jkarni
servant-quickcheck.cabal view
@@ -1,5 +1,5 @@ name:                servant-quickcheck-version:             0.0.1.1+version:             0.0.2.0 synopsis:            QuickCheck entire APIs description:  This packages provides QuickCheck properties that are tested across an entire@@ -13,8 +13,12 @@ build-type:          Simple cabal-version:       >=1.10 extra-source-files:-  CHANGELOG.md+  CHANGELOG.yaml +source-repository head+  type: git+  location: https://github.com/haskell-servant/servant-quickcheck+ flag long-tests   description: Run more QuickCheck tests   default:     False@@ -27,19 +31,19 @@                      , Servant.QuickCheck.Internal.QuickCheck                      , Servant.QuickCheck.Internal.Equality                      , Servant.QuickCheck.Internal.ErrorTypes-  build-depends:       base >=4.8 && <4.9+  build-depends:       base >=4.8 && <4.10                      , base-compat == 0.9.*                      , aeson > 0.8 && < 0.12                      , bytestring == 0.10.*                      , case-insensitive == 1.2.*-                     , data-default-class == 0.0.*+                     , data-default-class >= 0.0 && < 0.2                      , hspec == 2.2.*-                     , http-client == 0.4.*+                     , http-client >= 0.4.30 && < 0.5                      , http-media == 0.6.*                      , http-types > 0.8 && < 0.10                      , mtl > 2.1 && < 2.3                      , pretty == 1.1.*-                     , process == 1.2.*+                     , process >= 1.2 && < 1.5                      , QuickCheck > 2.7 && < 2.9                      , servant > 0.6 && < 0.9                      , servant-client > 0.6 && < 0.9
src/Servant/QuickCheck/Internal/HasGenRequest.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP       #-} {-# LANGUAGE PolyKinds #-} module Servant.QuickCheck.Internal.HasGenRequest where @@ -5,6 +6,7 @@ import Data.Monoid              ((<>)) import Data.String              (fromString) import Data.String.Conversions  (cs)+import qualified Data.ByteString as BS import GHC.TypeLits             (KnownSymbol, Nat, symbolVal) import Network.HTTP.Client      (Request, RequestBody (..), host, method, path,                                  port, queryString, requestBody, requestHeaders,@@ -43,6 +45,19 @@       where         old = genRequest (Proxy :: Proxy b)         new = arbitrary :: Gen c++#if MIN_VERSION_servant(0,8,0)+instance (Arbitrary c, HasGenRequest b, ToHttpApiData c )+    => HasGenRequest (CaptureAll x c :> b) where+    genRequest _ = do+      old' <- old+      new' <- fmap (cs . toUrlPiece) <$> new+      let new'' = BS.intercalate "/" new'+      return $ \burl -> let r = old' burl in r { path = new'' <> path r }+      where+        old = genRequest (Proxy :: Proxy b)+        new = arbitrary :: Gen [c]+#endif  instance (Arbitrary c, KnownSymbol h, HasGenRequest b, ToHttpApiData c)     => HasGenRequest (Header h c :> b) where
src/Servant/QuickCheck/Internal/Predicates.hs view
@@ -14,7 +14,7 @@ import           GHC.Generics          (Generic) import           Network.HTTP.Client   (Manager, Request, Response, httpLbs,                                         method, requestHeaders, responseBody,-                                        responseHeaders, parseUrl, responseStatus)+                                        responseHeaders, parseRequest, responseStatus) import           Network.HTTP.Media    (matchAccept) import           Network.HTTP.Types    (methodGet, methodHead, parseMethod,                                         renderStdMethod, status100, status200,@@ -92,7 +92,7 @@      if responseStatus resp == status201          then case lookup "Location" $ responseHeaders resp of              Nothing -> fail n-             Just l  -> case parseUrl $ SBSC.unpack l of+             Just l  -> case parseRequest $ SBSC.unpack l of                Nothing -> fail n                Just x  -> do                  resp2 <- httpLbs x mgr
test/Servant/QuickCheck/InternalSpec.hs view
@@ -5,7 +5,7 @@ import Control.Monad.IO.Class                     (liftIO) import Prelude.Compat import Servant-import Servant.API.Internal.Test.ComprehensiveAPI (comprehensiveAPI)+import Servant.API.Internal.Test.ComprehensiveAPI (comprehensiveAPIWithoutRaw) import Test.Hspec                                 (Spec, context, describe, it,                                                    shouldBe, shouldContain) import Test.Hspec.Core.Spec                       (Arg, Example, Result (..),@@ -81,7 +81,7 @@ isComprehensiveSpec = describe "HasGenRequest" $ do    it "has instances for all 'servant' combinators" $ do-    let _g = genRequest comprehensiveAPI+    let _g = genRequest comprehensiveAPIWithoutRaw     True `shouldBe` True -- This is a type-level check