Compare commits
32 Commits
matt/remov
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0535413b1a | ||
|
|
7cc95a8120 | ||
|
|
e1a919127a | ||
|
|
e6daf03c16 | ||
|
|
7926ad6bdb | ||
|
|
fa9cc11095 | ||
|
|
dfec2529ac | ||
|
|
eb3cdbcd3a | ||
|
|
f48088b7d2 | ||
|
|
2bf03e822a | ||
|
|
092ebe5423 | ||
|
|
13d32d6768 | ||
|
|
8e8e9b501b | ||
|
|
c93bd5a832 | ||
|
|
f9989bbf79 | ||
|
|
bb8177928e | ||
|
|
f6fb9033e9 | ||
|
|
804b06283d | ||
|
|
a5cdf78d82 | ||
|
|
638580ba49 | ||
|
|
8803b1c09e | ||
|
|
e69d4026af | ||
|
|
98fd048bdc | ||
|
|
902d7a7583 | ||
|
|
bc36737c45 | ||
|
|
0190e5e737 | ||
|
|
7d6a97af5a | ||
|
|
9743ac5ec4 | ||
|
|
e3bf044741 | ||
|
|
89c9170bdf | ||
|
|
35c98622fc | ||
|
|
cb06284c75 |
213
.travis.yml
213
.travis.yml
@ -1,109 +1,158 @@
|
||||
# This Travis job script has been generated by a script via
|
||||
#
|
||||
# runghc make_travis_yml_2.hs '--branch' 'master' '-o' '.travis.yml' 'servant-quickcheck.cabal'
|
||||
# haskell-ci '--config=cabal.haskell-ci' 'servant-quickcheck.cabal'
|
||||
#
|
||||
# For more information, see https://github.com/hvr/multi-ghc-travis
|
||||
# To regenerate the script (for example after adjusting tested-with) run
|
||||
#
|
||||
# haskell-ci regenerate
|
||||
#
|
||||
# For more information, see https://github.com/haskell-CI/haskell-ci
|
||||
#
|
||||
# version: 0.10.1
|
||||
#
|
||||
version: ~> 1.0
|
||||
language: c
|
||||
sudo: false
|
||||
|
||||
os: linux
|
||||
dist: xenial
|
||||
git:
|
||||
submodules: false # whether to recursively clone submodules
|
||||
|
||||
# whether to recursively clone submodules
|
||||
submodules: false
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cabal/packages
|
||||
- $HOME/.cabal/store
|
||||
|
||||
- $HOME/.hlint
|
||||
before_cache:
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
|
||||
# remove files that are regenerated by 'cabal update'
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
|
||||
|
||||
- rm -rfv $HOME/.cabal/packages/head.hackage
|
||||
|
||||
matrix:
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
|
||||
- rm -rfv $CABALHOME/packages/head.hackage
|
||||
jobs:
|
||||
include:
|
||||
- compiler: "ghc-7.10.3"
|
||||
# env: TEST=--disable-tests BENCH=--disable-benchmarks
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}
|
||||
- compiler: "ghc-8.0.2"
|
||||
# env: TEST=--disable-tests BENCH=--disable-benchmarks
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
|
||||
- compiler: "ghc-8.2.2"
|
||||
# env: TEST=--disable-tests BENCH=--disable-benchmarks
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}
|
||||
- compiler: "ghc-8.4.1"
|
||||
# env: TEST=--disable-tests BENCH=--disable-benchmarks
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}
|
||||
|
||||
- compiler: ghc-8.8.3
|
||||
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"]}}
|
||||
os: linux
|
||||
- compiler: ghc-8.6.5
|
||||
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"]}}
|
||||
os: linux
|
||||
- compiler: ghc-8.4.4
|
||||
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"]}}
|
||||
os: linux
|
||||
- compiler: ghc-8.2.2
|
||||
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"]}}
|
||||
os: linux
|
||||
- compiler: ghc-8.0.2
|
||||
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"]}}
|
||||
os: linux
|
||||
before_install:
|
||||
- HC=${CC}
|
||||
- HCPKG=${HC/ghc/ghc-pkg}
|
||||
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
|
||||
- WITHCOMPILER="-w $HC"
|
||||
- HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//')
|
||||
- HCPKG="$HC-pkg"
|
||||
- unset CC
|
||||
- ROOTDIR=$(pwd)
|
||||
- mkdir -p $HOME/.local/bin
|
||||
- "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
|
||||
- HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
|
||||
- CABAL=/opt/ghc/bin/cabal
|
||||
- CABALHOME=$HOME/.cabal
|
||||
- export PATH="$CABALHOME/bin:$PATH"
|
||||
- TOP=$(pwd)
|
||||
- "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
|
||||
- echo $HCNUMVER
|
||||
|
||||
- CABAL="$CABAL -vnormal+nowrap"
|
||||
- set -o pipefail
|
||||
- TEST=--enable-tests
|
||||
- BENCH=--enable-benchmarks
|
||||
- HEADHACKAGE=false
|
||||
- rm -f $CABALHOME/config
|
||||
- |
|
||||
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
|
||||
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
|
||||
echo "write-ghc-environment-files: always" >> $CABALHOME/config
|
||||
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
|
||||
echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
|
||||
echo "world-file: $CABALHOME/world" >> $CABALHOME/config
|
||||
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
|
||||
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
|
||||
echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
|
||||
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
|
||||
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
|
||||
echo "install-dirs user" >> $CABALHOME/config
|
||||
echo " prefix: $CABALHOME" >> $CABALHOME/config
|
||||
echo "repository hackage.haskell.org" >> $CABALHOME/config
|
||||
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
|
||||
install:
|
||||
- cabal --version
|
||||
- ${CABAL} --version
|
||||
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
|
||||
- BENCH=${BENCH---enable-benchmarks}
|
||||
- TEST=${TEST---enable-tests}
|
||||
- HADDOCK=${HADDOCK-true}
|
||||
- INSTALLED=${INSTALLED-true}
|
||||
- GHCHEAD=${GHCHEAD-false}
|
||||
- travis_retry cabal update -v
|
||||
- "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
|
||||
- rm -fv cabal.project cabal.project.local
|
||||
- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
|
||||
- "printf 'packages: \".\"\\n' > cabal.project"
|
||||
- cat cabal.project
|
||||
- if [ -f "./configure.ac" ]; then
|
||||
(cd "." && autoreconf -i);
|
||||
fi
|
||||
- rm -f cabal.project.freeze
|
||||
- cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
|
||||
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
|
||||
- rm -rf .ghc.environment.* "."/dist
|
||||
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
|
||||
|
||||
# Here starts the actual work to be performed for the package under test;
|
||||
# any command which exits with a non-zero exit code causes the build to fail.
|
||||
- |
|
||||
echo "program-default-options" >> $CABALHOME/config
|
||||
echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
|
||||
- cat $CABALHOME/config
|
||||
- rm -fv cabal.project cabal.project.local cabal.project.freeze
|
||||
- travis_retry ${CABAL} v2-update -v
|
||||
# Generate cabal.project
|
||||
- rm -rf cabal.project cabal.project.local cabal.project.freeze
|
||||
- touch cabal.project
|
||||
- |
|
||||
echo "packages: ." >> cabal.project
|
||||
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-quickcheck' >> cabal.project ; fi
|
||||
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
|
||||
- |
|
||||
- "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"
|
||||
- cat cabal.project || true
|
||||
- cat cabal.project.local || true
|
||||
- if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
|
||||
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
|
||||
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
|
||||
- rm cabal.project.freeze
|
||||
- travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
|
||||
- travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
|
||||
script:
|
||||
# test that source-distributions can be generated
|
||||
- (cd "." && cabal sdist)
|
||||
- mv "."/dist/servant-quickcheck-*.tar.gz ${DISTDIR}/
|
||||
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
|
||||
# Packaging...
|
||||
- ${CABAL} v2-sdist all
|
||||
# Unpacking...
|
||||
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
|
||||
- cd ${DISTDIR} || false
|
||||
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
|
||||
- "printf 'packages: servant-quickcheck-*/*.cabal\\n' > cabal.project"
|
||||
- cat cabal.project
|
||||
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
|
||||
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
|
||||
- PKGDIR_servant_quickcheck="$(find . -maxdepth 1 -type d -regex '.*/servant-quickcheck-[0-9.]*')"
|
||||
# Generate cabal.project
|
||||
- rm -rf cabal.project cabal.project.local cabal.project.freeze
|
||||
- touch cabal.project
|
||||
- |
|
||||
echo "packages: ${PKGDIR_servant_quickcheck}" >> cabal.project
|
||||
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-quickcheck' >> cabal.project ; fi
|
||||
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
|
||||
- |
|
||||
- "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"
|
||||
- cat cabal.project || true
|
||||
- cat cabal.project.local || true
|
||||
# Building...
|
||||
# this builds all libraries and executables (without tests/benchmarks)
|
||||
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
|
||||
|
||||
# Build with installed constraints for packages in global-db
|
||||
- if $INSTALLED; then echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; else echo "Not building with installed constraints"; fi
|
||||
|
||||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
|
||||
# Building with tests and benchmarks...
|
||||
# build & run tests, build benchmarks
|
||||
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
|
||||
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
|
||||
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
|
||||
# Testing...
|
||||
- ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
|
||||
# cabal check...
|
||||
- (cd ${PKGDIR_servant_quickcheck} && ${CABAL} -vnormal check)
|
||||
# haddock...
|
||||
- ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all
|
||||
# Building without installed constraints for packages in global-db...
|
||||
- rm -f cabal.project.local
|
||||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
|
||||
# Constraint sets
|
||||
- rm -rf cabal.project.local
|
||||
# Constraint set base-compat-0.10
|
||||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.10.*' all
|
||||
# Constraint set base-compat-0.11
|
||||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.11.*' all
|
||||
|
||||
# cabal check
|
||||
- (cd servant-quickcheck-* && cabal check)
|
||||
|
||||
# haddock
|
||||
- rm -rf ./dist-newstyle
|
||||
- if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
|
||||
|
||||
# REGENDATA ["--branch","master","-o",".travis.yml","servant-quickcheck.cabal"]
|
||||
# REGENDATA ("0.10.1",["--config=cabal.haskell-ci","servant-quickcheck.cabal"])
|
||||
# EOF
|
||||
|
||||
@ -1,4 +1,46 @@
|
||||
releases:
|
||||
- version: "0.0.9.0"
|
||||
changes:
|
||||
- description: "Support servant-0.15 (#65)"
|
||||
authors: fizruk
|
||||
date: 2020-06-25
|
||||
|
||||
- description: "Relax constraints for GHC 8.10 (#70)"
|
||||
authors: felixmulder
|
||||
date: 2020-06-20
|
||||
|
||||
- version: "0.0.8.0"
|
||||
changes:
|
||||
- description: Support for servant-0.17
|
||||
authors: phadej
|
||||
date: 2019-01-23
|
||||
|
||||
- version: "0.0.7.3"
|
||||
changes:
|
||||
- description: Support for servant-0.14
|
||||
issue: 53
|
||||
authors: phadej
|
||||
date: 2018-06-12
|
||||
|
||||
- description: Fix a failure from OnlyJsonObjects when there is no content-type.
|
||||
issue: 55
|
||||
authors: Phenitei
|
||||
date: 2018-08-27
|
||||
|
||||
- description: A bug fix where notAllowedContainsAllowHeader would print the initial request alongside the failure instead of the request causing the failure when it failed.
|
||||
issue: 57
|
||||
authors: Phenitei
|
||||
date: 2018-08-29
|
||||
|
||||
- description: QuickCheck 2.12 compatibility
|
||||
issue: 58
|
||||
authors: parsonsmatt
|
||||
date: 2018-10-12
|
||||
|
||||
- description: GHC 8.6 compatibility
|
||||
issue: 59
|
||||
authors: phadej
|
||||
date: 2018-10-15
|
||||
|
||||
- version: "0.0.7.2"
|
||||
changes:
|
||||
|
||||
7
cabal.haskell-ci
Normal file
7
cabal.haskell-ci
Normal file
@ -0,0 +1,7 @@
|
||||
branches: master
|
||||
|
||||
constraint-set base-compat-0.10
|
||||
constraints: base-compat ==0.10.*
|
||||
|
||||
constraint-set base-compat-0.11
|
||||
constraints: base-compat ==0.11.*
|
||||
4
cabal.project
Normal file
4
cabal.project
Normal file
@ -0,0 +1,4 @@
|
||||
packages: .
|
||||
tests: true
|
||||
|
||||
allow-newer: servant-blaze:servant
|
||||
@ -1,27 +1,22 @@
|
||||
name: servant-quickcheck
|
||||
version: 0.0.7.2
|
||||
synopsis: QuickCheck entire APIs
|
||||
name: servant-quickcheck
|
||||
version: 0.0.9.1
|
||||
synopsis: QuickCheck entire APIs
|
||||
description:
|
||||
This packages provides QuickCheck properties that are tested across an entire
|
||||
API.
|
||||
This packages provides QuickCheck properties that are tested across an entire
|
||||
API.
|
||||
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Julian K. Arni
|
||||
maintainer: jkarni@gmail.com
|
||||
category: Web
|
||||
build-type: Simple
|
||||
cabal-version: >=1.10
|
||||
extra-source-files:
|
||||
CHANGELOG.yaml
|
||||
tested-with:
|
||||
GHC==7.10.3,
|
||||
GHC==8.0.2,
|
||||
GHC==8.2.2,
|
||||
GHC==8.4.1
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Julian K. Arni
|
||||
maintainer: jkarni@gmail.com
|
||||
category: Web
|
||||
build-type: Simple
|
||||
cabal-version: >=1.10
|
||||
extra-source-files: CHANGELOG.yaml
|
||||
tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || == 8.8.3
|
||||
|
||||
source-repository head
|
||||
type: git
|
||||
type: git
|
||||
location: https://github.com/haskell-servant/servant-quickcheck
|
||||
|
||||
flag long-tests
|
||||
@ -29,107 +24,115 @@ flag long-tests
|
||||
default: False
|
||||
|
||||
library
|
||||
exposed-modules: Servant.QuickCheck
|
||||
, Servant.QuickCheck.Internal
|
||||
, Servant.QuickCheck.Internal.Predicates
|
||||
, Servant.QuickCheck.Internal.HasGenRequest
|
||||
, Servant.QuickCheck.Internal.QuickCheck
|
||||
, Servant.QuickCheck.Internal.Equality
|
||||
, Servant.QuickCheck.Internal.ErrorTypes
|
||||
build-depends: base >=4.8 && <4.12
|
||||
, base-compat-batteries >= 0.10.1 && <0.11
|
||||
, aeson > 0.8 && < 2
|
||||
, bytestring == 0.10.*
|
||||
, case-insensitive == 1.2.*
|
||||
, clock >= 0.7 && < 0.8
|
||||
, data-default-class >= 0.0 && < 0.2
|
||||
, hspec >= 2.5 && < 2.6
|
||||
, http-client >= 0.4.30 && < 0.6
|
||||
, http-media >= 0.6 && <0.8
|
||||
, http-types > 0.8 && < 0.13
|
||||
, mtl > 2.1 && < 2.3
|
||||
, pretty == 1.1.*
|
||||
, process >= 1.2 && < 1.7
|
||||
, QuickCheck > 2.7 && < 2.12
|
||||
, servant >= 0.13 && < 0.14
|
||||
, servant-client >= 0.13 && < 0.14
|
||||
, servant-server >= 0.13 && < 0.14
|
||||
, split == 0.2.*
|
||||
, string-conversions > 0.3 && < 0.5
|
||||
, temporary >= 1.2 && <1.4
|
||||
, text == 1.*
|
||||
, time >= 1.5 && < 1.9
|
||||
, warp >= 3.2.4 && < 3.3
|
||||
exposed-modules:
|
||||
Servant.QuickCheck
|
||||
Servant.QuickCheck.Internal
|
||||
Servant.QuickCheck.Internal.Equality
|
||||
Servant.QuickCheck.Internal.ErrorTypes
|
||||
Servant.QuickCheck.Internal.HasGenRequest
|
||||
Servant.QuickCheck.Internal.Predicates
|
||||
Servant.QuickCheck.Internal.QuickCheck
|
||||
|
||||
if !impl(ghc >= 8.0)
|
||||
build-depends:
|
||||
semigroups >= 0.18.3 && <0.19
|
||||
build-depends:
|
||||
aeson >=0.8 && <2
|
||||
, base >=4.9 && <4.15
|
||||
, base-compat-batteries >=0.10.1 && <0.12
|
||||
, bytestring >=0.10 && <0.11
|
||||
, case-insensitive >=1.2 && <1.3
|
||||
, clock >=0.7 && <0.9
|
||||
, data-default-class >=0.0 && <0.2
|
||||
, hspec >=2.5.6 && <2.8
|
||||
, http-client >=0.4.30 && <0.8
|
||||
, http-media >=0.6 && <0.9
|
||||
, http-types >=0.8 && <0.13
|
||||
, mtl >=2.1 && <2.3
|
||||
, pretty >=1.1 && <1.2
|
||||
, process >=1.2 && <1.7
|
||||
, QuickCheck >=2.7 && <2.15
|
||||
, servant >=0.17 && <0.19
|
||||
, servant-client >=0.17 && <0.19
|
||||
, servant-server >=0.17 && <0.19
|
||||
, split >=0.2 && <0.3
|
||||
, string-conversions >=0.3 && <0.5
|
||||
, temporary >=1.2 && <1.4
|
||||
, text >=1 && <2
|
||||
, time >=1.5 && <1.11
|
||||
, warp >=3.2.4 && <3.4
|
||||
|
||||
hs-source-dirs: src
|
||||
default-extensions: TypeOperators
|
||||
, FlexibleInstances
|
||||
, FlexibleContexts
|
||||
, DataKinds
|
||||
, GADTs
|
||||
, MultiParamTypeClasses
|
||||
, DeriveFunctor
|
||||
, KindSignatures
|
||||
, RankNTypes
|
||||
, ConstraintKinds
|
||||
, DeriveGeneric
|
||||
, ScopedTypeVariables
|
||||
, OverloadedStrings
|
||||
, FunctionalDependencies
|
||||
, NoImplicitPrelude
|
||||
, DeriveDataTypeable
|
||||
default-language: Haskell2010
|
||||
if !impl(ghc >=8.0)
|
||||
build-depends: semigroups >=0.18.3 && <0.20
|
||||
|
||||
hs-source-dirs: src
|
||||
default-extensions:
|
||||
NoImplicitPrelude
|
||||
ConstraintKinds
|
||||
DataKinds
|
||||
DeriveDataTypeable
|
||||
DeriveFunctor
|
||||
DeriveGeneric
|
||||
FlexibleContexts
|
||||
FlexibleInstances
|
||||
FunctionalDependencies
|
||||
GADTs
|
||||
KindSignatures
|
||||
MultiParamTypeClasses
|
||||
OverloadedStrings
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
TypeOperators
|
||||
|
||||
default-language: Haskell2010
|
||||
|
||||
test-suite spec
|
||||
type: exitcode-stdio-1.0
|
||||
ghc-options: -Wall -threaded
|
||||
default-language: Haskell2010
|
||||
hs-source-dirs: test
|
||||
main-is: Spec.hs
|
||||
other-modules: Servant.QuickCheck.InternalSpec
|
||||
build-tool-depends: hspec-discover:hspec-discover
|
||||
build-depends: base
|
||||
, base-compat-batteries
|
||||
, aeson
|
||||
, servant-quickcheck
|
||||
, bytestring
|
||||
, hspec
|
||||
, hspec-core
|
||||
, http-client
|
||||
, blaze-html
|
||||
, warp
|
||||
, servant-server
|
||||
, servant-client
|
||||
, servant
|
||||
, servant-blaze
|
||||
, transformers
|
||||
, QuickCheck
|
||||
, quickcheck-io
|
||||
default-extensions: TypeOperators
|
||||
, FlexibleInstances
|
||||
, FlexibleContexts
|
||||
, GADTs
|
||||
, DataKinds
|
||||
, NoImplicitPrelude
|
||||
, OverloadedStrings
|
||||
, ScopedTypeVariables
|
||||
type: exitcode-stdio-1.0
|
||||
ghc-options: -Wall -threaded
|
||||
default-language: Haskell2010
|
||||
hs-source-dirs: test
|
||||
main-is: Spec.hs
|
||||
other-modules: Servant.QuickCheck.InternalSpec
|
||||
build-tool-depends: hspec-discover:hspec-discover -any
|
||||
build-depends:
|
||||
aeson
|
||||
, base
|
||||
, base-compat-batteries
|
||||
, blaze-html
|
||||
, bytestring
|
||||
, hspec
|
||||
, hspec-core >=2.5.5 && <2.8
|
||||
, http-client
|
||||
, QuickCheck
|
||||
, quickcheck-io
|
||||
, servant
|
||||
, servant-blaze
|
||||
, servant-client
|
||||
, servant-quickcheck
|
||||
, servant-server
|
||||
, transformers
|
||||
, warp
|
||||
|
||||
default-extensions:
|
||||
NoImplicitPrelude
|
||||
DataKinds
|
||||
FlexibleContexts
|
||||
FlexibleInstances
|
||||
GADTs
|
||||
OverloadedStrings
|
||||
ScopedTypeVariables
|
||||
TypeOperators
|
||||
|
||||
if flag(long-tests)
|
||||
cpp-options: -DLONG_TESTS
|
||||
cpp-options: -DLONG_TESTS
|
||||
|
||||
test-suite example
|
||||
type: exitcode-stdio-1.0
|
||||
main-is: Main.hs
|
||||
hs-source-dirs:
|
||||
example
|
||||
ghc-options: -Wall
|
||||
type: exitcode-stdio-1.0
|
||||
main-is: Main.hs
|
||||
hs-source-dirs: example
|
||||
ghc-options: -Wall
|
||||
build-depends:
|
||||
base
|
||||
, hspec
|
||||
, servant-server
|
||||
, servant-quickcheck
|
||||
, servant-server
|
||||
, text
|
||||
|
||||
default-language: Haskell2010
|
||||
|
||||
@ -63,18 +63,14 @@ instance (KnownSymbol path, HasGenRequest b) => HasGenRequest (path :> b) where
|
||||
(oldf, old) = genRequest (Proxy :: Proxy b)
|
||||
new = cs $ symbolVal (Proxy :: Proxy path)
|
||||
|
||||
#if MIN_VERSION_servant(0,11,0)
|
||||
instance HasGenRequest EmptyAPI where
|
||||
genRequest _ = (0, error "EmptyAPIs cannot be queried.")
|
||||
#endif
|
||||
|
||||
#if MIN_VERSION_servant(0,12,0)
|
||||
instance HasGenRequest api => HasGenRequest (Summary d :> api) where
|
||||
genRequest _ = genRequest (Proxy :: Proxy api)
|
||||
|
||||
instance HasGenRequest api => HasGenRequest (Description d :> api) where
|
||||
genRequest _ = genRequest (Proxy :: Proxy api)
|
||||
#endif
|
||||
|
||||
instance (Arbitrary c, HasGenRequest b, ToHttpApiData c )
|
||||
=> HasGenRequest (Capture' mods x c :> b) where
|
||||
@ -86,7 +82,6 @@ instance (Arbitrary c, HasGenRequest b, ToHttpApiData c )
|
||||
(oldf, 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 _ = (oldf, do
|
||||
@ -97,7 +92,6 @@ instance (Arbitrary c, HasGenRequest b, ToHttpApiData c )
|
||||
where
|
||||
(oldf, old) = genRequest (Proxy :: Proxy b)
|
||||
new = arbitrary :: Gen [c]
|
||||
#endif
|
||||
|
||||
instance (Arbitrary c, KnownSymbol h, HasGenRequest b, ToHttpApiData c)
|
||||
=> HasGenRequest (Header' mods h c :> b) where
|
||||
@ -174,6 +168,15 @@ instance (ReflectMethod method)
|
||||
, method = reflectMethod (Proxy :: Proxy method)
|
||||
})
|
||||
|
||||
instance (ReflectMethod method)
|
||||
=> HasGenRequest (NoContentVerb (method :: k)) where
|
||||
genRequest _ = (1, return $ \burl -> defaultRequest
|
||||
{ host = cs $ baseUrlHost burl
|
||||
, port = baseUrlPort burl
|
||||
, secure = baseUrlScheme burl == Https
|
||||
, method = reflectMethod (Proxy :: Proxy method)
|
||||
})
|
||||
|
||||
instance (HasGenRequest a) => HasGenRequest (RemoteHost :> a) where
|
||||
genRequest _ = genRequest (Proxy :: Proxy a)
|
||||
|
||||
|
||||
@ -84,15 +84,13 @@ notLongerThan maxAllowed
|
||||
-- /Since 0.0.0.0/
|
||||
onlyJsonObjects :: ResponsePredicate
|
||||
onlyJsonObjects
|
||||
= ResponsePredicate (\resp -> case go resp of
|
||||
Nothing -> throw $ PredicateFailure "onlyJsonObjects" Nothing resp
|
||||
Just () -> return ())
|
||||
where
|
||||
go r = do
|
||||
ctyp <- lookup "content-type" (first foldedCase <$> responseHeaders r)
|
||||
when ("application/json" `SBS.isPrefixOf` ctyp) $ do
|
||||
(_ :: Object) <- decode (responseBody r)
|
||||
return ()
|
||||
= ResponsePredicate (\resp -> do
|
||||
case lookup "content-type" (first foldedCase <$> responseHeaders resp) of
|
||||
Nothing -> return ()
|
||||
Just ctype -> when ("application/json" `SBS.isPrefixOf` ctype) $ do
|
||||
case (decode (responseBody resp) :: Maybe Object) of
|
||||
Nothing -> throw $ PredicateFailure "onlyJsonObjects" Nothing resp
|
||||
Just _ -> return ())
|
||||
|
||||
-- | __Optional__
|
||||
--
|
||||
@ -189,14 +187,15 @@ getsHaveLastModifiedHeader
|
||||
notAllowedContainsAllowHeader :: RequestPredicate
|
||||
notAllowedContainsAllowHeader
|
||||
= RequestPredicate $ \req mgr -> do
|
||||
resp <- mapM (flip httpLbs mgr) $ [ req { method = renderStdMethod m }
|
||||
| m <- [minBound .. maxBound ]
|
||||
, renderStdMethod m /= method req ]
|
||||
case filter pred' resp of
|
||||
(x:_) -> throw $ PredicateFailure "notAllowedContainsAllowHeader" (Just req) x
|
||||
let reqs = [ req { method = renderStdMethod m } | m <- [minBound .. maxBound]
|
||||
, renderStdMethod m /= method req ]
|
||||
resp <- mapM (flip httpLbs mgr) reqs
|
||||
|
||||
case filter pred' (zip reqs resp) of
|
||||
(x:_) -> throw $ PredicateFailure "notAllowedContainsAllowHeader" (Just $ fst x) (snd x)
|
||||
[] -> return resp
|
||||
where
|
||||
pred' resp = responseStatus resp == status405 && not (hasValidHeader "Allow" go resp)
|
||||
pred' (_, resp) = responseStatus resp == status405 && not (hasValidHeader "Allow" go resp)
|
||||
where
|
||||
go x = all (\y -> isRight $ parseMethod $ SBSC.pack y)
|
||||
$ wordsBy (`elem` (", " :: [Char])) (SBSC.unpack x)
|
||||
|
||||
@ -11,6 +11,9 @@ import Network.Wai.Handler.Warp (withApplication)
|
||||
import Prelude.Compat
|
||||
import Servant (Context (EmptyContext), HasServer,
|
||||
Server, serveWithContext)
|
||||
#if MIN_VERSION_servant_server(0,18,0)
|
||||
import Servant (DefaultErrorFormatters, ErrorFormatters, HasContextEntry, type (.++))
|
||||
#endif
|
||||
import Servant.Client (BaseUrl (..), Scheme (..))
|
||||
import System.IO.Unsafe (unsafePerformIO)
|
||||
import Test.Hspec (Expectation, expectationFailure)
|
||||
@ -37,7 +40,11 @@ withServantServer api = withServantServerAndContext api EmptyContext
|
||||
-- application.
|
||||
--
|
||||
-- /Since 0.0.0.0/
|
||||
#if MIN_VERSION_servant_server(0,18,0)
|
||||
withServantServerAndContext :: (HasServer a ctx, HasContextEntry (ctx .++ DefaultErrorFormatters) ErrorFormatters)
|
||||
#else
|
||||
withServantServerAndContext :: HasServer a ctx
|
||||
#endif
|
||||
=> Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r
|
||||
withServantServerAndContext api ctx server t
|
||||
= withApplication (return . serveWithContext api ctx =<< server) $ \port ->
|
||||
@ -92,7 +99,10 @@ serversEqual api burl1 burl2 args req = do
|
||||
expectationFailure $ "We failed to record a reason for failure: " <> show r
|
||||
GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
|
||||
NoExpectedFailure {} -> expectationFailure "No expected failure"
|
||||
#if MIN_VERSION_QuickCheck(2,12,0)
|
||||
#else
|
||||
InsufficientCoverage {} -> expectationFailure "Insufficient coverage"
|
||||
#endif
|
||||
|
||||
-- | Check that a server satisfies the set of properties specified.
|
||||
--
|
||||
@ -145,7 +155,10 @@ serverSatisfiesMgr api manager burl args preds = do
|
||||
expectationFailure $ "We failed to record a reason for failure: " <> show r
|
||||
GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
|
||||
NoExpectedFailure {} -> expectationFailure $ "No expected failure"
|
||||
InsufficientCoverage {} -> expectationFailure $ "Insufficient coverage"
|
||||
#if MIN_VERSION_QuickCheck(2,12,0)
|
||||
#else
|
||||
InsufficientCoverage {} -> expectationFailure "Insufficient coverage"
|
||||
#endif
|
||||
|
||||
serverDoesntSatisfy :: (HasGenRequest a) =>
|
||||
Proxy a -> BaseUrl -> Args -> Predicates -> Expectation
|
||||
@ -163,7 +176,10 @@ serverDoesntSatisfyMgr api manager burl args preds = do
|
||||
GaveUp { numTests = n } -> expectationFailure $ "Gave up after " ++ show n ++ " tests"
|
||||
Failure { output = m } -> expectationFailure $ "Failed:\n" ++ show m
|
||||
NoExpectedFailure {} -> expectationFailure $ "No expected failure"
|
||||
InsufficientCoverage {} -> expectationFailure $ "Insufficient coverage"
|
||||
#if MIN_VERSION_QuickCheck(2,12,0)
|
||||
#else
|
||||
InsufficientCoverage {} -> expectationFailure "Insufficient coverage"
|
||||
#endif
|
||||
|
||||
noCheckStatus :: C.Request -> C.Request
|
||||
#if MIN_VERSION_http_client(0,5,0)
|
||||
|
||||
14
stack.yaml
14
stack.yaml
@ -1,14 +1,10 @@
|
||||
resolver: lts-11.8
|
||||
resolver: nightly-2018-09-03
|
||||
packages:
|
||||
- '.'
|
||||
extra-deps:
|
||||
- base-compat-batteries-0.10.1
|
||||
- base-compat-0.10.1
|
||||
- hspec-discover-2.5.0
|
||||
- hspec-core-2.5.0
|
||||
- hspec-2.5.0
|
||||
# aeson pre-1.3.1.0 has an upper bound on `base-compat-batteries` that preclude
|
||||
# the 0.10.1 that we depend on
|
||||
- aeson-1.3.1.0
|
||||
- hspec-discover-2.5.6
|
||||
- hspec-core-2.5.6
|
||||
- hspec-2.5.6
|
||||
- QuickCheck-2.12
|
||||
flags: {}
|
||||
extra-package-dbs: []
|
||||
|
||||
@ -23,12 +23,7 @@ import Test.QuickCheck.Gen (generate, unGen)
|
||||
import Test.QuickCheck.Random (mkQCGen)
|
||||
|
||||
|
||||
#if MIN_VERSION_servant(0,8,0)
|
||||
import Servant.API.Internal.Test.ComprehensiveAPI (comprehensiveAPIWithoutRaw)
|
||||
#else
|
||||
import Servant.API.Internal.Test.ComprehensiveAPI (ComprehensiveAPI,
|
||||
comprehensiveAPI)
|
||||
#endif
|
||||
import Servant.Test.ComprehensiveAPI (comprehensiveAPIWithoutStreamingOrRaw)
|
||||
|
||||
import Servant.QuickCheck
|
||||
import Servant.QuickCheck.Internal (genRequest, runGenRequest,
|
||||
@ -133,6 +128,10 @@ onlyJsonObjectSpec = describe "onlyJsonObjects" $ do
|
||||
withServantServerAndContext octetAPI ctx serverOctetAPI $ \burl ->
|
||||
serverSatisfies octetAPI burl args (onlyJsonObjects <%> mempty)
|
||||
|
||||
it "does not fail when there is no content-type" $ do
|
||||
withServantServerAndContext api2 ctx serverFailing $ \burl ->
|
||||
serverSatisfies api2 burl args (onlyJsonObjects <%> mempty)
|
||||
|
||||
notLongerThanSpec :: Spec
|
||||
notLongerThanSpec = describe "notLongerThan" $ do
|
||||
|
||||
@ -150,7 +149,7 @@ isComprehensiveSpec :: Spec
|
||||
isComprehensiveSpec = describe "HasGenRequest" $ do
|
||||
|
||||
it "has instances for all 'servant' combinators" $ do
|
||||
let _g = genRequest comprehensiveAPIWithoutRaw
|
||||
let _g = genRequest comprehensiveAPIWithoutStreamingOrRaw
|
||||
True `shouldBe` True -- This is a type-level check
|
||||
|
||||
deepPathSpec :: Spec
|
||||
@ -274,6 +273,9 @@ server2 = return $ return 1
|
||||
server3 :: IO (Server API2)
|
||||
server3 = return $ return 2
|
||||
|
||||
serverFailing :: IO (Server API2)
|
||||
serverFailing = return . throwError $ err405
|
||||
|
||||
-- With Doctypes
|
||||
type HtmlDoctype = Get '[HTML] Blaze.Html
|
||||
|
||||
@ -367,8 +369,3 @@ noOfTestCases = 20000
|
||||
#else
|
||||
noOfTestCases = 1000
|
||||
#endif
|
||||
|
||||
#if !MIN_VERSION_servant(0,8,0)
|
||||
comprehensiveAPIWithoutRaw :: Proxy ComprehensiveAPI
|
||||
comprehensiveAPIWithoutRaw = comprehensiveAPI
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user