git.iko.soy/servant-quickcheck
on master help sign in
Merge pull request #68 from haskell-servant/servant-0.17

Support servant-0.17

commit092ebe54230c557e0c1a829a578441492e5dfe58 authorOleg Grenrus <oleg.grenrus@iki.fi> dateFri 24 Jan 2020, 10:45 (7 years ago) parent8e8e9b513d32d6
4 files changed+49−52
.travis.yml+31−41 CHANGELOG.yaml+5 servant-quickcheck.cabal+4−5 src/Servant/QuickCheck/Internal/HasGenRequest.hs+9−6
.travis.yml+31−41
@@ -4,9 +4,11 @@
44#
55# For more information, see https://github.com/haskell-CI/haskell-ci
66#
7−# version: 0.5.20190908
7+# version: 0.9.20200121
88#
9+version: ~> 1.0
910language: c
11+os: linux
1012dist: xenial
1113git:
1214 # whether to recursively clone submodules
@@ -18,6 +20,7 @@ cache:
1820 directories:
1921 - $HOME/.cabal/packages
2022 - $HOME/.cabal/store
23+ - $HOME/.hlint
2124before_cache:
2225 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
2326 # remove files that are regenerated by 'cabal update'
@@ -27,18 +30,23 @@ before_cache:
2730 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
2831 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
2932 - rm -rfv $CABALHOME/packages/head.hackage
30−matrix:
33+jobs:
3134 include:
3235 - compiler: ghc-8.8.1
33− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}
36+ 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.1","cabal-install-3.0"]}}
37+ os: linux
3438 - compiler: ghc-8.6.5
35− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
39+ 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.0"]}}
40+ os: linux
3641 - compiler: ghc-8.4.4
37− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-3.0"]}}
42+ 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.0"]}}
43+ os: linux
3844 - compiler: ghc-8.2.2
39− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-3.0"]}}
45+ 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.0"]}}
46+ os: linux
4047 - compiler: ghc-8.0.2
41− addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-3.0"]}}
48+ 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.0"]}}
49+ os: linux
4250before_install:
4351 - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
4452 - WITHCOMPILER="-w $HC"
@@ -51,29 +59,8 @@ before_install:
5159 - TOP=$(pwd)
5260 - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
5361 - echo $HCNUMVER
54− - CABAL="$CABAL -vnormal+nowrap+markoutput"
62+ - CABAL="$CABAL -vnormal+nowrap"
5563 - 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 '?')]"
7764 - TEST=--enable-tests
7865 - BENCH=--enable-benchmarks
7966 - HEADHACKAGE=false
@@ -94,6 +81,9 @@ install:
9481 echo " prefix: $CABALHOME" >> $CABALHOME/config
9582 echo "repository hackage.haskell.org" >> $CABALHOME/config
9683 echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
84+install:
85+ - ${CABAL} --version
86+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
9787 - |
9888 echo "program-default-options" >> $CABALHOME/config
9989 echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
@@ -110,15 +100,15 @@ install:
110100 - cat cabal.project || true
111101 - cat cabal.project.local || true
112102 - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
113− - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
103+ - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
114104 - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
115105 - 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
106+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
107+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
118108script:
119109 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
120110 # Packaging...
121− - ${CABAL} v2-sdist all | color_cabal_output
111+ - ${CABAL} v2-sdist all
122112 # Unpacking...
123113 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
124114 - cd ${DISTDIR} || false
@@ -136,25 +126,25 @@ script:
136126 - cat cabal.project.local || true
137127 # Building...
138128 # this builds all libraries and executables (without tests/benchmarks)
139− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
129+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
140130 # Building with tests and benchmarks...
141131 # build & run tests, build benchmarks
142− - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
132+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
143133 # Testing...
144− - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
134+ - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
145135 # cabal check...
146136 - (cd ${PKGDIR_servant_quickcheck} && ${CABAL} -vnormal check)
147137 # haddock...
148− - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output
138+ - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all
149139 # Building without installed constraints for packages in global-db...
150140 - rm -f cabal.project.local
151− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
141+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
152142 # Constraint sets
153143 - rm -rf cabal.project.local
154144 # Constraint set base-compat-0.10
155− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.10.*' all | color_cabal_output
145+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.10.*' all
156146 # Constraint set base-compat-0.11
157− - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.11.*' all | color_cabal_output
147+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.11.*' all
158148
159−# REGENDATA ["--config=cabal.haskell-ci","servant-quickcheck.cabal"]
149+# REGENDATA ("0.9.20200121",["--config=cabal.haskell-ci","servant-quickcheck.cabal"])
160150# EOF
CHANGELOG.yaml+5
@@ -1,4 +1,9 @@
11releases:
2+ - version: "0.0.8.0"
3+ changes:
4+ - description: Support for servant-0.17
5+ authors: phadej
6+ date: 2019-01-23
27
38 - version: "0.0.7.3"
49 changes:
servant-quickcheck.cabal+4−5
@@ -1,6 +1,5 @@
11name: servant-quickcheck
2−version: 0.0.7.4
3−x-revision: 1
2+version: 0.0.8.0
43synopsis: QuickCheck entire APIs
54description:
65 This packages provides QuickCheck properties that are tested across an entire
@@ -50,9 +49,9 @@ library
5049 , pretty >=1.1 && <1.2
5150 , process >=1.2 && <1.7
5251 , QuickCheck >=2.7 && <2.14
53− , servant >=0.16 && <0.17
54− , servant-client >=0.16 && <0.17
55− , servant-server >=0.16 && <0.17
52+ , servant >=0.17 && <0.18
53+ , servant-client >=0.17 && <0.18
54+ , servant-server >=0.17 && <0.18
5655 , split >=0.2 && <0.3
5756 , string-conversions >=0.3 && <0.5
5857 , temporary >=1.2 && <1.4
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