Skip to content

Commit 89cb306

Browse files
authored
Merge pull request #682 from phadej/comprehensive-foreign
Add ComprehensiveAPI test for servant-foreign
2 parents 0b98132 + da1b198 commit 89cb306

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

servant-foreign/servant-foreign.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ module Servant.ForeignSpec where
66
import Data.Monoid ((<>))
77
import Data.Proxy
88
import Servant.Foreign
9+
import Servant.API.Internal.Test.ComprehensiveAPI
910

1011
import Test.Hspec
1112

13+
1214
spec :: Spec
1315
spec = 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
3036
instance HasForeignType LangX String NoContent where
3137
typeFor _ _ _ = "voidX"
3238

39+
instance HasForeignType LangX String (Headers ctyps NoContent) where
40+
typeFor _ _ _ = "voidX"
41+
3342
instance HasForeignType LangX String Int where
3443
typeFor _ _ _ = "intX"
3544

0 commit comments

Comments
 (0)