on master help sign in
Fix tests -- Capture cannot be empty
commit0edb828c1d46f2e5e3dda93a30803d30e130b46b authorChristian Marie <christian@ponies.io> dateMon 2 Feb 2015, 13:35 (12 years ago) parentcdbe95b
1 file changed+10−8
test/Servant/ClientSpec.hs+10−8
test/Servant/ClientSpec.hs+10−8
@@ -174,12 +174,12 @@ spec = do
174174
175175 modifyMaxSuccess (const 20) $ do
176176 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 ->
178178 ioProperty $ do
179179 withServer $ \ host -> do
180− result <- runEitherT (getMultiple a b c d host)
180+ result <- runEitherT (getMultiple cap num flag body host)
181181 return $
182− result === Right (a, b, c, d)
182+ result === Right (cap, num, flag, body)
183183
184184
185185 context "client correctly handles error status codes" $ do
@@ -248,9 +248,11 @@ openTestSocket = do
248248 port <- socketPort s
249249 return (fromIntegral port, s)
250250
251−pathGen :: Gen String
252−pathGen = listOf $ elements $
253− filter (not . (`elem` "?%[]/#")) $
254− filter isPrint $
255− map chr [0..127]
251+pathGen :: Gen (NonEmptyList Char)
252+pathGen = fmap NonEmpty path
253+ where
254+ path = listOf1 $ elements $
255+ filter (not . (`elem` "?%[]/#;")) $
256+ filter isPrint $
257+ map chr [0..127]
256258