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
|
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
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue