on master help sign in
Merge pull request #682 from phadej/comprehensive-foreign

Add ComprehensiveAPI test for servant-foreign

commit89cb3065de38076a4c492809cdc9ee79d8a1237e authorOleg Grenrus <oleg.grenrus@iki.fi> dateSun 22 Jan 2017, 12:54 (10 years ago) parent0b98132da1b198
2 files changed+10
servant-foreign/servant-foreign.cabal+1 servant-foreign/test/Servant/ForeignSpec.hs+9
servant-foreign/servant-foreign.cabal+1
@@ -67,6 +67,7 @@ test-suite spec
6767 other-modules: Servant.ForeignSpec
6868 build-depends: base
6969 , hspec >= 2.1.8
70+ , servant
7071 , servant-foreign
7172 default-language: Haskell2010
7273 default-extensions: ConstraintKinds
servant-foreign/test/Servant/ForeignSpec.hs+9
@@ -6,9 +6,11 @@ module Servant.ForeignSpec where
66import Data.Monoid ((<>))
77import Data.Proxy
88import Servant.Foreign
9+import Servant.API.Internal.Test.ComprehensiveAPI
910
1011import Test.Hspec
1112
13+
1214spec :: Spec
1315spec = describe "Servant.Foreign" $ do
1416 camelCaseSpec
@@ -22,6 +24,10 @@ camelCaseSpec = describe "camelCase" $ do
2224 camelCase (FunctionName ["get", "hyphen-ated", "counter"])
2325 `shouldBe` "getHyphen-atedCounter"
2426
27+----------------------------------------------------------------------
28+
29+-- This declaration simply checks that all instances are in place.
30+_ = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) comprehensiveAPIWithoutRaw
2531
2632----------------------------------------------------------------------
2733
@@ -30,6 +36,9 @@ data LangX
3036instance HasForeignType LangX String NoContent where
3137 typeFor _ _ _ = "voidX"
3238
39+instance HasForeignType LangX String (Headers ctyps NoContent) where
40+ typeFor _ _ _ = "voidX"
41+
3342instance HasForeignType LangX String Int where
3443 typeFor _ _ _ = "intX"
3544