on master help sign in
Fix tests -- Capture cannot be empty
0edb828Christian Marie
test/Servant/ClientSpec.hs+10−8
@@ -174,12 +174,12 @@ spec = do
174
174
175 modifyMaxSuccess (const 20) $ do
175 modifyMaxSuccess (const 20) $ do
176 it "works for a combination of Capture, QueryParam, QueryFlag and ReqBody" $
176 it "works for a combination of Capture, QueryParam, QueryFlag and ReqBody" $
177− property $ forAllShrink pathGen shrink $ \ a -> \ b c d ->
177+ property $ forAllShrink pathGen shrink $ \(NonEmpty cap) num flag body ->
178 ioProperty $ do
178 ioProperty $ do
179 withServer $ \ host -> do
179 withServer $ \ host -> do
180− result <- runEitherT (getMultiple a b c d host)
180+ result <- runEitherT (getMultiple cap num flag body host)
181 return $
181 return $
182− result === Right (a, b, c, d)
182+ result === Right (cap, num, flag, body)
183
183
184
184
185 context "client correctly handles error status codes" $ do
185 context "client correctly handles error status codes" $ do
@@ -248,9 +248,11 @@ openTestSocket = do
248 port <- socketPort s
248 port <- socketPort s
249 return (fromIntegral port, s)
249 return (fromIntegral port, s)
250
250
251−pathGen :: Gen String
251+pathGen :: Gen (NonEmptyList Char)
252+pathGen = fmap NonEmpty path
253+ where
252−pathGen = listOf $ elements $
254+ path = listOf1 $ elements $
253− filter (not . (`elem` "?%[]/#")) $
255+ filter (not . (`elem` "?%[]/#;")) $
254− filter isPrint $
256+ filter isPrint $
255− map chr [0..127]
257+ map chr [0..127]
256
258