blaze-builder-conduit 0.5.0 → 0.5.0.1
raw patch · 3 files changed
+8/−10 lines, 3 filesdep −HUnitdep ~basedep ~hspecPVP ok
version bump matches the API change (PVP)
Dependencies removed: HUnit
Dependency ranges changed: base, hspec
API changes (from Hackage documentation)
Files
- Data/Conduit/Blaze.hs +1/−0
- blaze-builder-conduit.cabal +2/−3
- test/main.hs +5/−7
Data/Conduit/Blaze.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE RankNTypes #-} -- | Convert a stream of blaze-builder @Builder@s into a stream of @ByteString@s. -- -- Adapted from blaze-builder-enumerator, written by myself and Simon Meier.
blaze-builder-conduit.cabal view
@@ -1,5 +1,5 @@ Name: blaze-builder-conduit-Version: 0.5.0+Version: 0.5.0.1 Synopsis: Convert streams of builders to streams of bytestrings. Description: Convert streams of builders to streams of bytestrings. License: BSD3@@ -30,8 +30,7 @@ cpp-options: -DTEST build-depends: conduit , base- , hspec- , HUnit+ , hspec == 1.3.* , QuickCheck , bytestring , blaze-builder
test/main.hs view
@@ -1,9 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE CPP #-}-import Test.Hspec.Monadic-import Test.Hspec.HUnit ()+import Test.Hspec import Test.Hspec.QuickCheck (prop)-import Test.HUnit import qualified Data.Conduit as C import qualified Data.Conduit.List as CL@@ -32,20 +30,20 @@ let lbs = toLazyByteString $ mconcat builders let src = mconcat $ map (CL.sourceList . return) builders outBss <- src C.$= builderToByteString C.$$ CL.consume- lbs @=? L.fromChunks outBss+ lbs `shouldBe` L.fromChunks outBss it "works for lazy bytestring insertion" $ do let builders = replicate 10000 (insertLazyByteString "hello world!") let lbs = toLazyByteString $ mconcat builders let src = mconcat $ map (CL.sourceList . return) builders outBss <- src C.$= builderToByteString C.$$ CL.consume- lbs @=? L.fromChunks outBss+ lbs `shouldBe` L.fromChunks outBss it "flush shouldn't bring in empty strings." $ do let dat = ["hello", "world"] src = CL.sourceList dat C.$= CL.map ((`mappend` flush) . fromByteString) out <- src C.$= builderToByteString C.$$ CL.consume- dat @=? out+ dat `shouldBe` out prop "flushing" $ \bss' -> runST $ do let bss = concatMap (\bs -> [C.Chunk $ S.pack bs, C.Flush]) $ filter (not . null) bss'@@ -60,4 +58,4 @@ bss <- src C.$$ builderToByteStringFlush C.=$ CL.consume let unFlush (C.Chunk x) = [x] unFlush C.Flush = []- L.fromChunks (concatMap unFlush bss) @?= lbs+ L.fromChunks (concatMap unFlush bss) `shouldBe` lbs