Add ComprehensiVeAPI test for servant-foreign

This commit is contained in:
Oleg Grenrus 2017-01-20 00:09:54 +02:00
parent 22b4d1301d
commit da1b1980eb
2 changed files with 10 additions and 0 deletions

View File

@ -67,6 +67,7 @@ test-suite spec
other-modules: Servant.ForeignSpec
build-depends: base
, hspec >= 2.1.8
, servant
, servant-foreign
default-language: Haskell2010
default-extensions: ConstraintKinds

View File

@ -6,9 +6,11 @@ module Servant.ForeignSpec where
import Data.Monoid ((<>))
import Data.Proxy
import Servant.Foreign
import Servant.API.Internal.Test.ComprehensiveAPI
import Test.Hspec
spec :: Spec
spec = describe "Servant.Foreign" $ do
camelCaseSpec
@ -22,6 +24,10 @@ camelCaseSpec = describe "camelCase" $ do
camelCase (FunctionName ["get", "hyphen-ated", "counter"])
`shouldBe` "getHyphen-atedCounter"
----------------------------------------------------------------------
-- This declaration simply checks that all instances are in place.
_ = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) comprehensiveAPIWithoutRaw
----------------------------------------------------------------------
@ -30,6 +36,9 @@ data LangX
instance HasForeignType LangX String NoContent where
typeFor _ _ _ = "voidX"
instance HasForeignType LangX String (Headers ctyps NoContent) where
typeFor _ _ _ = "voidX"
instance HasForeignType LangX String Int where
typeFor _ _ _ = "intX"