Merge pull request #682 from phadej/comprehensive-foreign
Add ComprehensiveAPI test for servant-foreign
This commit is contained in:
commit
89cb3065de
2 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue