git.iko.soy/servant-quickcheck
on master help sign in
6 files changed+79−60
since splitsnapshots
unifiedsplit
.travis.yml+40−42 CHANGELOG.yaml+12−3 cabal.project+2 servant-quickcheck.cabal+9−9 src/Servant/QuickCheck/Internal/HasGenRequest.hs+9−6 src/Servant/QuickCheck/Internal/QuickCheck.hs+7
.travis.yml+40−42
@@ -2,11 +2,17 @@
22#
33# haskell-ci '--config=cabal.haskell-ci' 'servant-quickcheck.cabal'
44#
5+# To regenerate the script (for example after adjusting tested-with) run
6+#
7+# haskell-ci regenerate
8+#
59# For more information, see https://github.com/haskell-CI/haskell-ci
610#
7−# version: 0.5.20190908
11+# version: 0.10.1
812#
13+version: ~> 1.0
914language: c
15+os: linux
1016dist: xenial
1117git:
1218 # whether to recursively clone submodules
@@ -18,6 +24,7 @@ cache:
1824 directories:
1925 - $HOME/.cabal/packages
2026 - $HOME/.cabal/store
27+ - $HOME/.hlint
2128before_cache:
2229 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
2330 # remove files that are regenerated by 'cabal update'
@@ -27,18 +34,23 @@ before_cache:
2734 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
2835 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
2936 - rm -rfv $CABALHOME/packages/head.hackage
30−matrix:
37+jobs:
3138 include:
32− - compiler: ghc-8.8.1
33− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}
39+ - compiler: ghc-8.8.3
40+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2"]}}
41+ os: linux
3442 - compiler: ghc-8.6.5
35− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
43+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}}
44+ os: linux
3645 - compiler: ghc-8.4.4
37− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-3.0"]}}
46+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}}
47+ os: linux
3848 - compiler: ghc-8.2.2
39− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-3.0"]}}
49+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}}
50+ os: linux
4051 - compiler: ghc-8.0.2
41− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-3.0"]}}
52+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}}
53+ os: linux
4254before_install:
4355 - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
4456 - WITHCOMPILER="-w $HC"
@@ -51,29 +63,8 @@ before_install:
5163 - TOP=$(pwd)
5264 - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
5365 - echo $HCNUMVER
54− - CABAL="$CABAL -vnormal+nowrap+markoutput"
66+ - CABAL="$CABAL -vnormal+nowrap"
5567 - set -o pipefail
56− - |
57− echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
58− echo 'BEGIN { state = "output"; }' >> .colorful.awk
59− echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
60− echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
61− echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
62− echo ' if (state == "cabal") {' >> .colorful.awk
63− echo ' print blue($0)' >> .colorful.awk
64− echo ' } else {' >> .colorful.awk
65− echo ' print $0' >> .colorful.awk
66− echo ' }' >> .colorful.awk
67− echo '}' >> .colorful.awk
68− - cat .colorful.awk
69− - |
70− color_cabal_output () {
71− awk -f $TOP/.colorful.awk
72− }
73− - echo text | color_cabal_output
74−install:
75− - ${CABAL} --version
76− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
7768 - TEST=--enable-tests
7869 - BENCH=--enable-benchmarks
7970 - HEADHACKAGE=false
@@ -94,6 +85,9 @@ install:
9485 echo " prefix: $CABALHOME" >> $CABALHOME/config
9586 echo "repository hackage.haskell.org" >> $CABALHOME/config
9687 echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
88+install:
89+ - ${CABAL} --version
90+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
9791 - |
9892 echo "program-default-options" >> $CABALHOME/config
9993 echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
@@ -105,20 +99,22 @@ install:
10599 - touch cabal.project
106100 - |
107101 echo "packages: ." >> cabal.project
102+ - if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-quickcheck' >> cabal.project ; fi
103+ - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
108104 - |
109105 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-quickcheck)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
110106 - cat cabal.project || true
111107 - cat cabal.project.local || true
112108 - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
113− - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
109+ - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
114110 - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
115111 - rm cabal.project.freeze
116− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
117− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
112+ - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
113+ - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
118114script:
119115 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
120116 # Packaging...
121− - ${CABAL} v2-sdist all | color_cabal_output
117+ - ${CABAL} v2-sdist all
122118 # Unpacking...
123119 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
124120 - cd ${DISTDIR} || false
@@ -130,31 +126,33 @@ script:
130126 - touch cabal.project
131127 - |
132128 echo "packages: ${PKGDIR_servant_quickcheck}" >> cabal.project
129+ - if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-quickcheck' >> cabal.project ; fi
130+ - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
133131 - |
134132 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-quickcheck)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
135133 - cat cabal.project || true
136134 - cat cabal.project.local || true
137135 # Building...
138136 # this builds all libraries and executables (without tests/benchmarks)
139− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
137+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
140138 # Building with tests and benchmarks...
141139 # build & run tests, build benchmarks
142− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
140+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
143141 # Testing...
144− - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
142+ - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
145143 # cabal check...
146144 - (cd ${PKGDIR_servant_quickcheck} && ${CABAL} -vnormal check)
147145 # haddock...
148− - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output
146+ - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all
149147 # Building without installed constraints for packages in global-db...
150148 - rm -f cabal.project.local
151− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
149+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
152150 # Constraint sets
153151 - rm -rf cabal.project.local
154152 # Constraint set base-compat-0.10
155− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.10.*' all | color_cabal_output
153+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.10.*' all
156154 # Constraint set base-compat-0.11
157− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.11.*' all | color_cabal_output
155+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.11.*' all
158156
159−# REGENDATA ["--config=cabal.haskell-ci","servant-quickcheck.cabal"]
157+# REGENDATA ("0.10.1",["--config=cabal.haskell-ci","servant-quickcheck.cabal"])
160158# EOF
CHANGELOG.yaml+12−3
@@ -1,10 +1,19 @@
11releases:
2+ - version: "0.0.9.0"
3+ changes:
4+ - description: "Support servant-0.15 (#65)"
5+ authors: fizruk
6+ date: 2020-06-25
7+
8+ - description: "Relax constraints for GHC 8.10 (#70)"
9+ authors: felixmulder
10+ date: 2020-06-20
211
3− - version: "0.8"
12+ - version: "0.0.8.0"
413 changes:
5− - description: Support GHC-8.8. Allow newer versions of other dependencies.
14+ - description: Support for servant-0.17
615 authors: phadej
7− date: 2019-09-15
16+ date: 2019-01-23
817
918 - version: "0.0.7.3"
1019 changes:
cabal.project+2
@@ -1,2 +1,4 @@
11packages: .
22tests: true
3+
4+allow-newer: servant-blaze:servant
servant-quickcheck.cabal+9−9
@@ -1,5 +1,5 @@
11name: servant-quickcheck
2−version: 0.0.8
2+version: 0.0.9.1
33synopsis: QuickCheck entire APIs
44description:
55 This packages provides QuickCheck properties that are tested across an entire
@@ -13,7 +13,7 @@ category: Web
1313build-type: Simple
1414cabal-version: >=1.10
1515extra-source-files: CHANGELOG.yaml
16−tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || == 8.8.1
16+tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || == 8.8.3
1717
1818source-repository head
1919 type: git
@@ -35,28 +35,28 @@ library
3535
3636 build-depends:
3737 aeson >=0.8 && <2
38− , base >=4.9 && <4.14
38+ , base >=4.9 && <4.15
3939 , base-compat-batteries >=0.10.1 && <0.12
4040 , bytestring >=0.10 && <0.11
4141 , case-insensitive >=1.2 && <1.3
4242 , clock >=0.7 && <0.9
4343 , data-default-class >=0.0 && <0.2
4444 , hspec >=2.5.6 && <2.8
45− , http-client >=0.4.30 && <0.7
45+ , http-client >=0.4.30 && <0.8
4646 , http-media >=0.6 && <0.9
4747 , http-types >=0.8 && <0.13
4848 , mtl >=2.1 && <2.3
4949 , pretty >=1.1 && <1.2
5050 , process >=1.2 && <1.7
51− , QuickCheck >=2.7 && <2.14
52− , servant >=0.16 && <0.17
53− , servant-client >=0.16 && <0.17
54− , servant-server >=0.16 && <0.17
51+ , QuickCheck >=2.7 && <2.15
52+ , servant >=0.17 && <0.19
53+ , servant-client >=0.17 && <0.19
54+ , servant-server >=0.17 && <0.19
5555 , split >=0.2 && <0.3
5656 , string-conversions >=0.3 && <0.5
5757 , temporary >=1.2 && <1.4
5858 , text >=1 && <2
59− , time >=1.5 && <1.10
59+ , time >=1.5 && <1.11
6060 , warp >=3.2.4 && <3.4
6161
6262 if !impl(ghc >=8.0)
src/Servant/QuickCheck/Internal/HasGenRequest.hs+9−6
@@ -63,18 +63,14 @@ instance (KnownSymbol path, HasGenRequest b) => HasGenRequest (path :> b) where
6363 (oldf, old) = genRequest (Proxy :: Proxy b)
6464 new = cs $ symbolVal (Proxy :: Proxy path)
6565
66−#if MIN_VERSION_servant(0,11,0)
6766instance HasGenRequest EmptyAPI where
6867 genRequest _ = (0, error "EmptyAPIs cannot be queried.")
69−#endif
7068
71−#if MIN_VERSION_servant(0,12,0)
7269instance HasGenRequest api => HasGenRequest (Summary d :> api) where
7370 genRequest _ = genRequest (Proxy :: Proxy api)
7471
7572instance HasGenRequest api => HasGenRequest (Description d :> api) where
7673 genRequest _ = genRequest (Proxy :: Proxy api)
77−#endif
7874
7975instance (Arbitrary c, HasGenRequest b, ToHttpApiData c )
8076 => HasGenRequest (Capture' mods x c :> b) where
@@ -86,7 +82,6 @@ instance (Arbitrary c, HasGenRequest b, ToHttpApiData c )
8682 (oldf, old) = genRequest (Proxy :: Proxy b)
8783 new = arbitrary :: Gen c
8884
89−#if MIN_VERSION_servant(0,8,0)
9085instance (Arbitrary c, HasGenRequest b, ToHttpApiData c )
9186 => HasGenRequest (CaptureAll x c :> b) where
9287 genRequest _ = (oldf, do
@@ -97,7 +92,6 @@ instance (Arbitrary c, HasGenRequest b, ToHttpApiData c )
9792 where
9893 (oldf, old) = genRequest (Proxy :: Proxy b)
9994 new = arbitrary :: Gen [c]
100−#endif
10195
10296instance (Arbitrary c, KnownSymbol h, HasGenRequest b, ToHttpApiData c)
10397 => HasGenRequest (Header' mods h c :> b) where
@@ -174,6 +168,15 @@ instance (ReflectMethod method)
174168 , method = reflectMethod (Proxy :: Proxy method)
175169 })
176170
171+instance (ReflectMethod method)
172+ => HasGenRequest (NoContentVerb (method :: k)) where
173+ genRequest _ = (1, return $ \burl -> defaultRequest
174+ { host = cs $ baseUrlHost burl
175+ , port = baseUrlPort burl
176+ , secure = baseUrlScheme burl == Https
177+ , method = reflectMethod (Proxy :: Proxy method)
178+ })
179+
177180instance (HasGenRequest a) => HasGenRequest (RemoteHost :> a) where
178181 genRequest _ = genRequest (Proxy :: Proxy a)
179182
src/Servant/QuickCheck/Internal/QuickCheck.hs+7
@@ -11,6 +11,9 @@ import Network.Wai.Handler.Warp (withApplication)
1111import Prelude.Compat
1212import Servant (Context (EmptyContext), HasServer,
1313 Server, serveWithContext)
14+#if MIN_VERSION_servant_server(0,18,0)
15+import Servant (DefaultErrorFormatters, ErrorFormatters, HasContextEntry, type (.++))
16+#endif
1417import Servant.Client (BaseUrl (..), Scheme (..))
1518import System.IO.Unsafe (unsafePerformIO)
1619import Test.Hspec (Expectation, expectationFailure)
@@ -37,7 +40,11 @@ withServantServer api = withServantServerAndContext api EmptyContext
3740-- application.
3841--
3942-- /Since 0.0.0.0/
43+#if MIN_VERSION_servant_server(0,18,0)
44+withServantServerAndContext :: (HasServer a ctx, HasContextEntry (ctx .++ DefaultErrorFormatters) ErrorFormatters)
45+#else
4046withServantServerAndContext :: HasServer a ctx
47+#endif
4148 => Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r
4249withServantServerAndContext api ctx server t
4350 = withApplication (return . serveWithContext api ctx =<< server) $ \port ->