implemented stripCRLF
This commit is contained in:
@@ -31,7 +31,14 @@ import Data.Connection (Connection (..))
|
||||
import Data.IORef (IORef, modifyIORef', newIORef, readIORef)
|
||||
import Data.X509 (Certificate (..))
|
||||
import System.IO.Streams (nullInput, unRead)
|
||||
import Test.Hspec (Spec, context, describe, it, shouldReturn, xit)
|
||||
import Test.Hspec (
|
||||
Spec,
|
||||
context,
|
||||
describe,
|
||||
it,
|
||||
shouldBe,
|
||||
shouldReturn,
|
||||
xit)
|
||||
|
||||
import Network.Gemini.Capsule.Types
|
||||
import Network.Gemini.Capsule.Internal
|
||||
@@ -83,7 +90,7 @@ runConnectionSpec = describe "runConnection" $ mapM_
|
||||
readURLSpec :: Spec
|
||||
readURLSpec = describe "readURL" $ mapM_
|
||||
( \(desc, ioConn, expect) -> context desc $
|
||||
xit ("should return " ++ show expect) $
|
||||
it ("should return " ++ show expect) $
|
||||
do
|
||||
conn <- ioConn
|
||||
readURL conn `shouldReturn` expect
|
||||
@@ -115,7 +122,7 @@ sendResponseSpec = describe "sendResponse" $ return ()
|
||||
strFromConnSpec :: Spec
|
||||
strFromConnSpec = describe "strFromConn" $ mapM_
|
||||
( \(desc, maxLen, ioConn, expect) -> context desc $
|
||||
xit ("should return " ++ show expect) $ do
|
||||
it ("should return " ++ show expect) $ do
|
||||
conn <- ioConn
|
||||
strFromConn maxLen conn `shouldReturn` expect
|
||||
)
|
||||
@@ -154,7 +161,18 @@ readMaxSpec = describe "readMax" $ mapM_
|
||||
longBS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
stripCRLFSpec :: Spec
|
||||
stripCRLFSpec = describe "stripCRLF" $ return ()
|
||||
stripCRLFSpec = describe "stripCRLF" $ mapM_
|
||||
( \(input, expected) -> context (show input) $
|
||||
it ("should be" ++ show expected) $
|
||||
stripCRLF input `shouldBe` expected
|
||||
)
|
||||
|
||||
-- input, expectation
|
||||
[ ( "foo\r\n", Just "foo" )
|
||||
, ( "foo\n", Nothing )
|
||||
, ( "foo", Nothing )
|
||||
, ( "\r\n", Just "" )
|
||||
]
|
||||
|
||||
mkIOConn :: [BS.ByteString] -> IO (Connection (), IORef [BSL.ByteString])
|
||||
mkIOConn input = do
|
||||
|
||||
Reference in New Issue
Block a user