Fix tests -- Capture cannot be empty

This commit is contained in:
Christian Marie 2015-02-02 13:35:10 +11:00
parent cdbe95bcdf
commit 0edb828c1d

View file

@ -174,12 +174,12 @@ spec = do
modifyMaxSuccess (const 20) $ do modifyMaxSuccess (const 20) $ do
it "works for a combination of Capture, QueryParam, QueryFlag and ReqBody" $ it "works for a combination of Capture, QueryParam, QueryFlag and ReqBody" $
property $ forAllShrink pathGen shrink $ \ a -> \ b c d -> property $ forAllShrink pathGen shrink $ \(NonEmpty cap) num flag body ->
ioProperty $ do ioProperty $ do
withServer $ \ host -> do withServer $ \ host -> do
result <- runEitherT (getMultiple a b c d host) result <- runEitherT (getMultiple cap num flag body host)
return $ return $
result === Right (a, b, c, d) result === Right (cap, num, flag, body)
context "client correctly handles error status codes" $ do context "client correctly handles error status codes" $ do
@ -248,9 +248,11 @@ openTestSocket = do
port <- socketPort s port <- socketPort s
return (fromIntegral port, s) return (fromIntegral port, s)
pathGen :: Gen String pathGen :: Gen (NonEmptyList Char)
pathGen = listOf $ elements $ pathGen = fmap NonEmpty path
filter (not . (`elem` "?%[]/#")) $ where
filter isPrint $ path = listOf1 $ elements $
map chr [0..127] filter (not . (`elem` "?%[]/#;")) $
filter isPrint $
map chr [0..127]