implemented encodeGemResponse
This commit is contained in:
@@ -20,6 +20,8 @@ License along with this program. If not, see
|
||||
|
||||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Network.Gemini.Capsule.EncodingSpec (spec) where
|
||||
|
||||
import Test.Hspec (Spec, context, describe, it, shouldBe)
|
||||
@@ -33,6 +35,7 @@ spec = describe "Encoding" $ do
|
||||
decodeGemURLSpec
|
||||
escapeStringSpec
|
||||
unescapeStringSpec
|
||||
encodeGemResponseSpec
|
||||
|
||||
encodeGemURLSpec :: Spec
|
||||
encodeGemURLSpec = describe "encodeGemURL" $ mapM_
|
||||
@@ -143,4 +146,12 @@ unescapeStringSpec = describe "unescapeString" $ mapM_
|
||||
, ( "foo%ff", Nothing )
|
||||
]
|
||||
|
||||
encodeGemResponseSpec :: Spec
|
||||
encodeGemResponseSpec = describe "encodeGemResponse" $
|
||||
it ("should be " ++ show expect) $
|
||||
encodeGemResponse resp `shouldBe` expect
|
||||
where
|
||||
resp = newGemResponse { respBody = Just "Success!\r\n" }
|
||||
expect = "20 text/gemini\r\nSuccess!\r\n"
|
||||
|
||||
--jl
|
||||
|
||||
@@ -37,8 +37,7 @@ import Test.Hspec (
|
||||
describe,
|
||||
it,
|
||||
shouldBe,
|
||||
shouldReturn,
|
||||
xit)
|
||||
shouldReturn)
|
||||
|
||||
import Network.Gemini.Capsule.Types
|
||||
import Network.Gemini.Capsule.Internal
|
||||
@@ -47,7 +46,6 @@ spec :: Spec
|
||||
spec = describe "Internal" $ do
|
||||
runConnectionSpec
|
||||
readURLSpec
|
||||
sendResponseSpec
|
||||
strFromConnSpec
|
||||
readMaxSpec
|
||||
stripCRLFSpec
|
||||
@@ -55,7 +53,7 @@ spec = describe "Internal" $ do
|
||||
runConnectionSpec :: Spec
|
||||
runConnectionSpec = describe "runConnection" $ mapM_
|
||||
( \(desc, ioConnRef, handler, mCert, expect) -> context desc $
|
||||
xit ("should return " ++ show expect) $ do
|
||||
it ("should return " ++ show expect) $ do
|
||||
(conn, outRef) <- ioConnRef
|
||||
runConnection conn handler mCert
|
||||
readIORef outRef `shouldReturn` expect
|
||||
@@ -116,9 +114,6 @@ readURLSpec = describe "readURL" $ mapM_
|
||||
longDir = replicate (1024 - BS.length prefix) 'A'
|
||||
prefix = "gemini://example.com/"
|
||||
|
||||
sendResponseSpec :: Spec
|
||||
sendResponseSpec = describe "sendResponse" $ return ()
|
||||
|
||||
strFromConnSpec :: Spec
|
||||
strFromConnSpec = describe "strFromConn" $ mapM_
|
||||
( \(desc, maxLen, ioConn, expect) -> context desc $
|
||||
|
||||
Reference in New Issue
Block a user