packages feed

conduit-extra 1.1.7.1 → 1.1.7.2

raw patch · 5 files changed

+32/−11 lines, 5 filesdep ~streaming-commonsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: streaming-commons

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.1.7.2++* Fix for: Decompressing a specific amount of zlib data "eats" following data [#20](https://github.com/fpco/streaming-commons/issues/20)+ ## 1.1.7  Add `Data.Conduit.ByteString.Builder`
Data/Conduit/Zlib.hs view
@@ -43,7 +43,7 @@     => WindowBits -- ^ Zlib parameter (see the zlib-bindings package as well as the zlib C library)     -> Conduit ByteString m ByteString decompress =-    helperDecompress (liftM (fmap Chunk) await) yield'+    helperDecompress (liftM (fmap Chunk) await) yield' leftover   where     yield' Flush = return ()     yield' (Chunk bs) = yield bs@@ -53,19 +53,23 @@     :: (MonadBase base m, PrimMonad base, MonadThrow m)     => WindowBits -- ^ Zlib parameter (see the zlib-bindings package as well as the zlib C library)     -> Conduit (Flush ByteString) m (Flush ByteString)-decompressFlush = helperDecompress await yield+decompressFlush = helperDecompress await yield (leftover . Chunk)  helperDecompress :: (Monad (t m), MonadBase base m, PrimMonad base, MonadThrow m, MonadTrans t)                  => t m (Maybe (Flush ByteString))                  -> (Flush ByteString -> t m ())+                 -> (ByteString -> t m ())                  -> WindowBits                  -> t m ()-helperDecompress await' yield' config =+helperDecompress await' yield' leftover' config =     await' >>= maybe (return ()) start   where     start input = do         inf <- lift $ unsafeLiftIO $ initInflate config         push inf input++        rem' <- lift $ unsafeLiftIO $ getUnusedInflate inf+        unless (S.null rem') $ leftover' rem'      continue inf = await' >>= maybe (close inf) (push inf) 
conduit-extra.cabal view
@@ -1,5 +1,5 @@ Name:                conduit-extra-Version:             1.1.7.1+Version:             1.1.7.2 Synopsis:            Batteries included conduit: adapters for common libraries. Description:     The conduit package itself maintains relative small dependencies. The purpose of this package is to collect commonly used utility functions wrapping other library dependencies, without depending on heavier-weight dependencies. The basic idea is that this package should only depend on haskell-platform packages and conduit.@@ -52,7 +52,7 @@                      , process                      , resourcet                >= 1.1                      , stm-                     , streaming-commons        >= 0.1.10+                     , streaming-commons        >= 0.1.11    ghc-options:     -Wall 
test/Data/Conduit/TextSpec.hs view
@@ -183,9 +183,6 @@         it "works with empty lines" $             (CL.sourceList ["\n\n"] C.$= CT.lines C.$$ CL.consume) ==                 [["", ""]]-        it "is not too eager" $ do-            x <- CL.sourceList ["foobarbaz", error "ignore me"] C.$$ CT.decode CT.utf8 C.=$ CL.head-            x `shouldBe` Just "foobarbaz"      describe "text lines bounded" $ do         it "yields nothing given nothing" $@@ -212,9 +209,6 @@         it "works with empty lines" $             (CL.sourceList ["\n\n"] C.$= CT.linesBounded 80 C.$$ CL.consume) ==                 [["", ""]]-        it "is not too eager" $ do-            x <- CL.sourceList ["foobarbaz", error "ignore me"] C.$$ CT.decode CT.utf8 C.=$ CL.head-            x `shouldBe` Just "foobarbaz"         it "throws an exception when lines are too long" $ do             x <- runExceptionT $ CL.sourceList ["hello\nworld"] C.$$ CT.linesBounded 4 C.=$ CL.consume             show x `shouldBe` show (Left $ CT.LengthExceeded 4 :: Either CT.TextException ())@@ -227,6 +221,9 @@             case x of                 Left _ -> return ()                 Right t -> error $ "This should have failed: " ++ show t+        it "is not too eager" $ do+            x <- CL.sourceList ["foobarbaz", error "ignore me"] C.$$ CT.decode CT.utf8 C.=$ CL.head+            x `shouldBe` Just "foobarbaz"  it' :: String -> IO () -> Spec it' = it
test/Data/Conduit/ZlibSpec.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE OverloadedStrings #-} module Data.Conduit.ZlibSpec (spec) where  import Test.Hspec@@ -47,3 +48,18 @@                 unChunk C.Flush = []             bss <- CL.sourceList bssC C.$$ CL.concatMap unChunk C.=$ CZ.ungzip C.=$ CL.consume             L.fromChunks bss `shouldBe` content++        it "uncompressed after compressed" $ do+            let c = "This data is stored compressed."+                u = "This data isn't."+            let src1 = do+                    C.yield c C.$= CZ.gzip+                    C.yield u+            encoded <- src1 C.$$ CL.consume+            let src2 = mapM_ C.yield encoded+            (c', u') <- src2 C.$$ do+                c' <- CZ.ungzip C.=$ CL.consume+                u' <- CL.consume+                return (S.concat c', S.concat u')+            c' `shouldBe` c+            u' `shouldBe` u