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 other-modules: Servant.ForeignSpec
build-depends: base build-depends: base
, hspec >= 2.1.8 , hspec >= 2.1.8
, servant
, servant-foreign , servant-foreign
default-language: Haskell2010 default-language: Haskell2010
default-extensions: ConstraintKinds default-extensions: ConstraintKinds

View File

@ -6,9 +6,11 @@ module Servant.ForeignSpec where
import Data.Monoid ((<>)) import Data.Monoid ((<>))
import Data.Proxy import Data.Proxy
import Servant.Foreign import Servant.Foreign
import Servant.API.Internal.Test.ComprehensiveAPI
import Test.Hspec import Test.Hspec
spec :: Spec spec :: Spec
spec = describe "Servant.Foreign" $ do spec = describe "Servant.Foreign" $ do
camelCaseSpec camelCaseSpec
@ -22,6 +24,10 @@ camelCaseSpec = describe "camelCase" $ do
camelCase (FunctionName ["get", "hyphen-ated", "counter"]) camelCase (FunctionName ["get", "hyphen-ated", "counter"])
`shouldBe` "getHyphen-atedCounter" `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 instance HasForeignType LangX String NoContent where
typeFor _ _ _ = "voidX" typeFor _ _ _ = "voidX"
instance HasForeignType LangX String (Headers ctyps NoContent) where
typeFor _ _ _ = "voidX"
instance HasForeignType LangX String Int where instance HasForeignType LangX String Int where
typeFor _ _ _ = "intX" typeFor _ _ _ = "intX"