@@ -6,9 +6,11 @@ module Servant.ForeignSpec where
6import Data.Monoid ((<>))
6import Data.Monoid ((<>))
7import Data.Proxy
7import Data.Proxy
8import Servant.Foreign
8import Servant.Foreign
9+import Servant.API.Internal.Test.ComprehensiveAPI
10import Test.Hspec
11import Test.Hspec
12spec :: Spec
14spec :: Spec
13spec = describe "Servant.Foreign" $ do
15spec = describe "Servant.Foreign" $ do
14 camelCaseSpec
16 camelCaseSpec
@@ -22,6 +24,10 @@ camelCaseSpec = describe "camelCase" $ do
22 camelCase (FunctionName ["get", "hyphen-ated", "counter"])
24 camelCase (FunctionName ["get", "hyphen-ated", "counter"])
23 `shouldBe` "getHyphen-atedCounter"
25 `shouldBe` "getHyphen-atedCounter"
27+----------------------------------------------------------------------
29+-- This declaration simply checks that all instances are in place.
30+_ = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) comprehensiveAPIWithoutRaw
26----------------------------------------------------------------------
32----------------------------------------------------------------------
@@ -30,6 +36,9 @@ data LangX
30instance HasForeignType LangX String NoContent where
36instance HasForeignType LangX String NoContent where
31 typeFor _ _ _ = "voidX"
37 typeFor _ _ _ = "voidX"
39+instance HasForeignType LangX String (Headers ctyps NoContent) where
40+ typeFor _ _ _ = "voidX"
33instance HasForeignType LangX String Int where
42instance HasForeignType LangX String Int where
34 typeFor _ _ _ = "intX"
43 typeFor _ _ _ = "intX"