From 7d07db7ed30df90bc9c4de4e332e80204345fee3 Mon Sep 17 00:00:00 2001 From: David Turner Date: Tue, 16 May 2017 16:25:01 +0000 Subject: [PATCH] Add test for safeLink applied to an EmptyAPI type --- servant/test/Servant/Utils/LinksSpec.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/servant/test/Servant/Utils/LinksSpec.hs b/servant/test/Servant/Utils/LinksSpec.hs index 05abd67a..b8dbcee7 100644 --- a/servant/test/Servant/Utils/LinksSpec.hs +++ b/servant/test/Servant/Utils/LinksSpec.hs @@ -25,6 +25,7 @@ type TestApi = :<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] NoContent :<|> "delete" :> Header "ponies" String :> Delete '[JSON] NoContent :<|> "raw" :> Raw + :<|> NoEndpoint apiLink :: (IsElem endpoint TestApi, HasLink endpoint) @@ -98,6 +99,11 @@ spec = describe "Servant.Utils.Links" $ do -- ...Could not deduce... -- ... -- +-- >>> apiLink (Proxy :: Proxy NoEndpoint) +-- ... +-- ...No instance for... +-- ... +-- -- sanity check -- >>> toUrlPiece $ apiLink (Proxy :: Proxy AllGood) -- "get" @@ -107,3 +113,4 @@ type WrongContentType = "get" :> Get '[OctetStream] NoContent type WrongMethod = "get" :> Post '[JSON] NoContent type NotALink = "hello" :> ReqBody '[JSON] 'True :> Get '[JSON] Bool type AllGood = "get" :> Get '[JSON] NoContent +type NoEndpoint = "empty" :> EmptyAPI