git.iko.soy/typeable/servant
on master help sign in
Enable testing recipe
a4151acOleg Grenrus
.travis.yml+8−5
@@ -69,11 +69,11 @@ install:
69 - rm -fv cabal.project cabal.project.local
69 - rm -fv cabal.project cabal.project.local
70 - "if [ $HCNUMVER -ge 70800 ]; then sed -i.bak 's/-- ghc-options:.*/ghc-options: -j2/' ${HOME}/.cabal/config; fi"
70 - "if [ $HCNUMVER -ge 70800 ]; then sed -i.bak 's/-- ghc-options:.*/ghc-options: -j2/' ${HOME}/.cabal/config; fi"
71 - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
71 - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
72− - "printf 'packages: \"servant\" \"servant-client\" \"servant-client-core\" \"servant-docs\" \"servant-foreign\" \"servant-server\" \"doc/tutorial\" \"doc/cookbook/basic-auth\" \"doc/cookbook/curl-mock\" \"doc/cookbook/db-postgres-pool\" \"doc/cookbook/db-sqlite-simple\" \"doc/cookbook/file-upload\" \"doc/cookbook/generic\" \"doc/cookbook/https\" \"doc/cookbook/sentry\" \"doc/cookbook/structuring-apis\" \"doc/cookbook/using-custom-monad\" \"doc/cookbook/using-free-client\"\\n' > cabal.project"
72+ - "printf 'packages: \"servant\" \"servant-client\" \"servant-client-core\" \"servant-docs\" \"servant-foreign\" \"servant-server\" \"doc/tutorial\" \"doc/cookbook/basic-auth\" \"doc/cookbook/curl-mock\" \"doc/cookbook/db-postgres-pool\" \"doc/cookbook/db-sqlite-simple\" \"doc/cookbook/file-upload\" \"doc/cookbook/generic\" \"doc/cookbook/https\" \"doc/cookbook/sentry\" \"doc/cookbook/testing\" \"doc/cookbook/structuring-apis\" \"doc/cookbook/using-custom-monad\" \"doc/cookbook/using-free-client\"\\n' > cabal.project"
73 - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project"
73 - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project"
74 - "echo 'allow-newer: servant-auth-server:http-types,servant-auth-server:servant-server,servant-js:base, servant-pagination:servant,servant-pagination:servant-server' >> cabal.project"
74 - "echo 'allow-newer: servant-auth-server:http-types,servant-auth-server:servant-server,servant-js:base, servant-pagination:servant,servant-pagination:servant-server' >> cabal.project"
75 - touch cabal.project.local
75 - touch cabal.project.local
76− - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant | grep -vw -- servant-client | grep -vw -- servant-client-core | grep -vw -- servant-docs | grep -vw -- servant-foreign | grep -vw -- servant-server | grep -vw -- tutorial | grep -vw -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-https | grep -vw -- cookbook-sentry | grep -vw -- cookbook-structuring-apis | grep -vw -- cookbook-using-custom-monad | grep -vw -- cookbook-using-free-client | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
76+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant | grep -vw -- servant-client | grep -vw -- servant-client-core | grep -vw -- servant-docs | grep -vw -- servant-foreign | grep -vw -- servant-server | grep -vw -- tutorial | grep -vw -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-https | grep -vw -- cookbook-sentry | grep -vw -- cookbook-testing | grep -vw -- cookbook-structuring-apis | grep -vw -- cookbook-using-custom-monad | grep -vw -- cookbook-using-free-client | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
77 - cat cabal.project || true
77 - cat cabal.project || true
78 - cat cabal.project.local || true
78 - cat cabal.project.local || true
79 - if [ -f "servant/configure.ac" ]; then
79 - if [ -f "servant/configure.ac" ]; then
@@ -121,6 +121,9 @@ install:
121 - if [ -f "doc/cookbook/sentry/configure.ac" ]; then
121 - if [ -f "doc/cookbook/sentry/configure.ac" ]; then
122 (cd "doc/cookbook/sentry" && autoreconf -i);
122 (cd "doc/cookbook/sentry" && autoreconf -i);
123 fi
123 fi
124+ - if [ -f "doc/cookbook/testing/configure.ac" ]; then
125+ (cd "doc/cookbook/testing" && autoreconf -i);
126+ fi
124 - if [ -f "doc/cookbook/structuring-apis/configure.ac" ]; then
127 - if [ -f "doc/cookbook/structuring-apis/configure.ac" ]; then
125 (cd "doc/cookbook/structuring-apis" && autoreconf -i);
128 (cd "doc/cookbook/structuring-apis" && autoreconf -i);
126 fi
129 fi
@@ -131,7 +134,7 @@ install:
131 (cd "doc/cookbook/using-free-client" && autoreconf -i);
134 (cd "doc/cookbook/using-free-client" && autoreconf -i);
132 fi
135 fi
133 - rm -f cabal.project.freeze
136 - rm -f cabal.project.freeze
134− - rm -rf .ghc.environment.* "servant"/dist "servant-client"/dist "servant-client-core"/dist "servant-docs"/dist "servant-foreign"/dist "servant-server"/dist "doc/tutorial"/dist "doc/cookbook/basic-auth"/dist "doc/cookbook/curl-mock"/dist "doc/cookbook/db-postgres-pool"/dist "doc/cookbook/db-sqlite-simple"/dist "doc/cookbook/file-upload"/dist "doc/cookbook/generic"/dist "doc/cookbook/https"/dist "doc/cookbook/sentry"/dist "doc/cookbook/structuring-apis"/dist "doc/cookbook/using-custom-monad"/dist "doc/cookbook/using-free-client"/dist
137+ - rm -rf .ghc.environment.* "servant"/dist "servant-client"/dist "servant-client-core"/dist "servant-docs"/dist "servant-foreign"/dist "servant-server"/dist "doc/tutorial"/dist "doc/cookbook/basic-auth"/dist "doc/cookbook/curl-mock"/dist "doc/cookbook/db-postgres-pool"/dist "doc/cookbook/db-sqlite-simple"/dist "doc/cookbook/file-upload"/dist "doc/cookbook/generic"/dist "doc/cookbook/https"/dist "doc/cookbook/sentry"/dist "doc/cookbook/testing"/dist "doc/cookbook/structuring-apis"/dist "doc/cookbook/using-custom-monad"/dist "doc/cookbook/using-free-client"/dist
135 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
138 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
136
139
137# Here starts the actual work to be performed for the package under test;
140# Here starts the actual work to be performed for the package under test;
@@ -145,11 +148,11 @@ script:
145 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
148 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
146 - cd ${DISTDIR} || false
149 - cd ${DISTDIR} || false
147 - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
150 - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
148− - "printf 'packages: servant-*/*.cabal servant-client-*/*.cabal servant-client-core-*/*.cabal servant-docs-*/*.cabal servant-foreign-*/*.cabal servant-server-*/*.cabal tutorial-*/*.cabal cookbook-basic-auth-*/*.cabal cookbook-curl-mock-*/*.cabal cookbook-db-postgres-pool-*/*.cabal cookbook-db-sqlite-simple-*/*.cabal cookbook-file-upload-*/*.cabal cookbook-generic-*/*.cabal cookbook-https-*/*.cabal cookbook-sentry-*/*.cabal cookbook-structuring-apis-*/*.cabal cookbook-using-custom-monad-*/*.cabal cookbook-using-free-client-*/*.cabal\\n' > cabal.project"
151+ - "printf 'packages: servant-*/*.cabal servant-client-*/*.cabal servant-client-core-*/*.cabal servant-docs-*/*.cabal servant-foreign-*/*.cabal servant-server-*/*.cabal tutorial-*/*.cabal cookbook-basic-auth-*/*.cabal cookbook-curl-mock-*/*.cabal cookbook-db-postgres-pool-*/*.cabal cookbook-db-sqlite-simple-*/*.cabal cookbook-file-upload-*/*.cabal cookbook-generic-*/*.cabal cookbook-https-*/*.cabal cookbook-sentry-*/*.cabal cookbook-testing-*/*.cabal cookbook-structuring-apis-*/*.cabal cookbook-using-custom-monad-*/*.cabal cookbook-using-free-client-*/*.cabal\\n' > cabal.project"
149 - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project"
152 - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project"
150 - "echo 'allow-newer: servant-auth-server:http-types,servant-auth-server:servant-server,servant-js:base, servant-pagination:servant,servant-pagination:servant-server' >> cabal.project"
153 - "echo 'allow-newer: servant-auth-server:http-types,servant-auth-server:servant-server,servant-js:base, servant-pagination:servant,servant-pagination:servant-server' >> cabal.project"
151 - touch cabal.project.local
154 - touch cabal.project.local
152− - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant | grep -vw -- servant-client | grep -vw -- servant-client-core | grep -vw -- servant-docs | grep -vw -- servant-foreign | grep -vw -- servant-server | grep -vw -- tutorial | grep -vw -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-https | grep -vw -- cookbook-sentry | grep -vw -- cookbook-structuring-apis | grep -vw -- cookbook-using-custom-monad | grep -vw -- cookbook-using-free-client | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
155+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant | grep -vw -- servant-client | grep -vw -- servant-client-core | grep -vw -- servant-docs | grep -vw -- servant-foreign | grep -vw -- servant-server | grep -vw -- tutorial | grep -vw -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-https | grep -vw -- cookbook-sentry | grep -vw -- cookbook-testing | grep -vw -- cookbook-structuring-apis | grep -vw -- cookbook-using-custom-monad | grep -vw -- cookbook-using-free-client | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
153 - cat cabal.project || true
156 - cat cabal.project || true
154 - cat cabal.project.local || true
157 - cat cabal.project.local || true
155 - echo -en 'travis_fold:end:unpack\\r'
158 - echo -en 'travis_fold:end:unpack\\r'
cabal.project+1−1
@@ -19,7 +19,7 @@ packages: servant/
19 -- doc/cookbook/jwt-and-basic-auth/
19 -- doc/cookbook/jwt-and-basic-auth/
20 -- doc/cookbook/pagination
20 -- doc/cookbook/pagination
21 doc/cookbook/sentry
21 doc/cookbook/sentry
22− -- doc/cookbook/testing
22+ doc/cookbook/testing
23 doc/cookbook/structuring-apis
23 doc/cookbook/structuring-apis
24 doc/cookbook/using-custom-monad
24 doc/cookbook/using-custom-monad
25 doc/cookbook/using-free-client
25 doc/cookbook/using-free-client
doc/cookbook/testing/Testing.lhs+7−4
@@ -41,6 +41,9 @@ This recipe starts with the following ingredients:
41```haskell
41```haskell
42{-# LANGUAGE OverloadedStrings, TypeFamilies, DataKinds,
42{-# LANGUAGE OverloadedStrings, TypeFamilies, DataKinds,
43 DeriveGeneric, TypeOperators #-}
43 DeriveGeneric, TypeOperators #-}
44+import Prelude ()
45+import Prelude.Compat
46+
44import qualified Control.Concurrent as C
47import qualified Control.Concurrent as C
45import Control.Concurrent.MVar
48import Control.Concurrent.MVar
46import Control.Exception (bracket)
49import Control.Exception (bracket)
@@ -48,9 +51,9 @@ import Control.Lens hiding (Context)
48import Data.Aeson
51import Data.Aeson
49import Data.Aeson.Lens
52import Data.Aeson.Lens
50import qualified Data.HashMap.Strict as HM
53import qualified Data.HashMap.Strict as HM
51−import Data.Text
54+import Data.Text (Text, unpack)
52import GHC.Generics
55import GHC.Generics
53−import Network.HTTP.Client hiding (Proxy)
56+import Network.HTTP.Client hiding (Proxy)
54import Network.HTTP.Types
57import Network.HTTP.Types
55import Network.Wai
58import Network.Wai
56import qualified Network.Wai.Handler.Warp as Warp
59import qualified Network.Wai.Handler.Warp as Warp
@@ -407,7 +410,7 @@ server :: IO (Server API)
407server = do
410server = do
408 mvar <- newMVar ""
411 mvar <- newMVar ""
409 return $ (\x -> liftIO $ swapMVar mvar x)
412 return $ (\x -> liftIO $ swapMVar mvar x)
410− :<|> (liftIO $ readMVar mvar >>= return . Prelude.length)
413+ :<|> (liftIO $ readMVar mvar >>= return . length)
411 :<|> (const $ return ())
414 :<|> (const $ return ())
412```
415```
413
416
@@ -502,4 +505,4 @@ Lastly, if you want a broad overview of where your application fits in with
502regard to best practices, consider using `servant-quickcheck`.
505regard to best practices, consider using `servant-quickcheck`.
503
506
504This program is available as a cabal project
507This program is available as a cabal project
505−[here](https://github.com/haskell-servant/servant/tree/master/doc/cookbook/testing).
508+[here](https://github.com/haskell-servant/servant/tree/master/doc/cookbook/testing).
doc/cookbook/testing/testing.cabal+1
@@ -15,6 +15,7 @@ tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.1
15executable cookbook-testing
15executable cookbook-testing
16 main-is: Testing.lhs
16 main-is: Testing.lhs
17 build-depends: base == 4.*
17 build-depends: base == 4.*
18+ , base-compat
18 , text >= 1.2
19 , text >= 1.2
19 , aeson >= 1.2
20 , aeson >= 1.2
20 , lens-aeson
21 , lens-aeson
servant-client-core/servant-client-core.cabal+4−4
@@ -66,7 +66,7 @@ library
66 , base64-bytestring >= 1.0.0.1 && < 1.1
66 , base64-bytestring >= 1.0.0.1 && < 1.1
67 , exceptions >= 0.10.0 && < 0.11
67 , exceptions >= 0.10.0 && < 0.11
68 , free >= 5.0.2 && < 5.2
68 , free >= 5.0.2 && < 5.2
69− , generics-sop >= 0.3.2.0 && < 0.4
69+ , generics-sop >= 0.4.0.1 && < 0.5
70 , http-api-data >= 0.3.8.1 && < 0.4
70 , http-api-data >= 0.3.8.1 && < 0.4
71 , http-media >= 0.7.1.2 && < 0.8
71 , http-media >= 0.7.1.2 && < 0.8
72 , http-types >= 0.12.1 && < 0.13
72 , http-types >= 0.12.1 && < 0.13
@@ -94,9 +94,9 @@ test-suite spec
94
94
95 -- Additonal dependencies
95 -- Additonal dependencies
96 build-depends:
96 build-depends:
97− deepseq >= 1.3.0.2 && <1.5
97+ deepseq >= 1.3.0.2 && < 1.5
98− , hspec >= 2.4.1 && <2.6
98+ , hspec >= 2.4.1 && < 2.6
99− , QuickCheck >= 2.11.3 && < 2.12
99+ , QuickCheck >= 2.12.6.1 && < 2.13
100
100
101 build-tool-depends:
101 build-tool-depends:
102 hspec-discover:hspec-discover >= 2.5.1 && <2.6
102 hspec-discover:hspec-discover >= 2.5.1 && <2.6
servant-client/servant-client.cabal+5−5
@@ -100,11 +100,11 @@ test-suite spec
100
100
101 -- Additonal dependencies
101 -- Additonal dependencies
102 build-depends:
102 build-depends:
103− generics-sop >= 0.3.2.0 && < 0.4
103+ generics-sop >= 0.4.0.1 && < 0.5
104− , hspec >= 2.5.1 && < 2.6
104+ , hspec >= 2.5.1 && < 2.6
105− , HUnit >= 1.6 && < 1.7
105+ , HUnit >= 1.6 && < 1.7
106− , network >= 2.6.3.2 && < 2.8
106+ , network >= 2.8.0.0 && < 2.9
107− , QuickCheck >= 2.10.1 && < 2.12
107+ , QuickCheck >= 2.12.6.1 && < 2.13
108 , servant == 0.14.*
108 , servant == 0.14.*
109 , servant-server == 0.14.*
109 , servant-server == 0.14.*
110
110
servant-server/servant-server.cabal+1−1
@@ -164,7 +164,7 @@ test-suite spec
164 , directory >= 1.2.1.0 && < 1.4
164 , directory >= 1.2.1.0 && < 1.4
165 , hspec >= 2.5.1 && < 2.6
165 , hspec >= 2.5.1 && < 2.6
166 , hspec-wai >= 0.9.0 && < 0.10
166 , hspec-wai >= 0.9.0 && < 0.10
167− , QuickCheck >= 2.11.3 && < 2.12
167+ , QuickCheck >= 2.12.6.1 && < 2.13
168 , should-not-typecheck >= 2.1.0 && < 2.2
168 , should-not-typecheck >= 2.1.0 && < 2.2
169 , temporary >= 1.3 && < 1.4
169 , temporary >= 1.3 && < 1.4
170 , wai-extra >= 3.0.21.0 && < 3.1
170 , wai-extra >= 3.0.21.0 && < 3.1
servant/servant.cabal+4−4
@@ -146,10 +146,10 @@ test-suite spec
146
146
147 -- Additonal dependencies
147 -- Additonal dependencies
148 build-depends:
148 build-depends:
149− aeson-compat >= 0.3.8 && < 0.4
149+ aeson-compat >= 0.3.8 && < 0.4
150− , hspec >= 2.5.4 && < 2.6
150+ , hspec >= 2.5.4 && < 2.6
151− , QuickCheck >= 2.11.3 && < 2.12
151+ , QuickCheck >= 2.12.6.1 && < 2.13
152− , quickcheck-instances >= 0.3.18 && < 0.4
152+ , quickcheck-instances >= 0.3.19 && < 0.4
153
153
154 build-tool-depends:
154 build-tool-depends:
155 hspec-discover:hspec-discover >= 2.5.4 && < 2.6
155 hspec-discover:hspec-discover >= 2.5.4 && < 2.6
stack.yaml+5−1
@@ -1,5 +1,5 @@
1# Let's try to keep resolver at the first day of the month
1# Let's try to keep resolver at the first day of the month
2−resolver: nightly-2018-07-08
2+resolver: nightly-2018-09-28 # Last nightly with GHC-8.4.3
3packages:
3packages:
4- servant-client/
4- servant-client/
5- servant-client-core/
5- servant-client-core/
@@ -10,3 +10,7 @@ packages:
10
10
11# allow-newer: true # ignores all bounds, that's a sledgehammer
11# allow-newer: true # ignores all bounds, that's a sledgehammer
12# - doc/tutorial/
12# - doc/tutorial/
13+
14+extra-deps:
15+- generics-sop-0.4.0.1
16+- sop-core-0.4.0.0