From da1b1980eb01cac0043eab655c0547620716d8d0 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Fri, 20 Jan 2017 00:09:54 +0200 Subject: [PATCH] Add ComprehensiVeAPI test for servant-foreign --- servant-foreign/servant-foreign.cabal | 1 + servant-foreign/test/Servant/ForeignSpec.hs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/servant-foreign/servant-foreign.cabal b/servant-foreign/servant-foreign.cabal index cb684393..37c94251 100644 --- a/servant-foreign/servant-foreign.cabal +++ b/servant-foreign/servant-foreign.cabal @@ -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 diff --git a/servant-foreign/test/Servant/ForeignSpec.hs b/servant-foreign/test/Servant/ForeignSpec.hs index 65244df6..d88c1abb 100644 --- a/servant-foreign/test/Servant/ForeignSpec.hs +++ b/servant-foreign/test/Servant/ForeignSpec.hs @@ -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"