conduit 1.0.7.2 → 1.0.7.3
raw patch · 3 files changed
+26/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/Conduit/Text.hs +6/−5
- conduit.cabal +1/−1
- test/main.hs +19/−6
Data/Conduit/Text.hs view
@@ -212,18 +212,19 @@ isContinuation byte = byte .&. 0xC0 == 0x80 -- The number of continuation bytes needed by the given- -- non-continuation byte.+ -- non-continuation byte. Returns -1 for an illegal UTF-8+ -- non-continuation byte and the whole split quickly must fail so+ -- as the input is passed to TE.decodeUtf8, which will issue a+ -- suitable error. required x0 | x0 .&. 0x80 == 0x00 = 0 | x0 .&. 0xE0 == 0xC0 = 1 | x0 .&. 0xF0 == 0xE0 = 2 | x0 .&. 0xF8 == 0xF0 = 3- | otherwise = err-- err = error "Data.Conduit.Text.utf8: expected non-continuation byte"+ | otherwise = -1 splitQuickly bytes- | B.null l = Nothing+ | B.null l || req == -1 = Nothing | req == B.length r = Just (TE.decodeUtf8 bytes, B.empty) | otherwise = Just (TE.decodeUtf8 l', r') where
conduit.cabal view
@@ -1,5 +1,5 @@ Name: conduit-Version: 1.0.7.2+Version: 1.0.7.3 Synopsis: Streaming data processing library. Description: @conduit@ is a solution to the streaming data problem, allowing for production, transformation, and consumption of streams of data in constant memory. It is an alternative to lazy I\/O which guarantees deterministic resource handling, and fits in the same general solution space as @enumerator@\/@iteratee@ and @pipes@. For a tutorial, please visit <https://haskell.fpcomplete.com/user/snoyberg/library-documentation/conduit-overview>.
test/main.hs view
@@ -389,7 +389,7 @@ (a, b) `shouldBe` (Just 1, [1..10]) describe "text" $ do- let go enc tenc cenc = do+ let go enc tenc tdec cenc = do prop (enc ++ " single chunk") $ \chars -> runST $ runExceptionT_ $ do let tl = TL.pack chars lbs = tenc tl@@ -400,19 +400,32 @@ let tl = TL.pack chars lbs = tenc tl src = mconcat $ map (CL.sourceList . return . S.singleton) $ L.unpack lbs+ ts <- src C.$= CT.decode cenc C.$$ CL.consume return $ TL.fromChunks ts == tl++ -- Check whether raw bytes are decoded correctly, in+ -- particular that Text decoding produces an error if+ -- and only if Conduit does.+ prop (enc ++ " raw bytes") $ \bytes ->+ let lbs = L.pack bytes+ src = CL.sourceList $ L.toChunks lbs+ etl = C.runException $ src C.$= CT.decode cenc C.$$ CL.consume+ tl' = tdec lbs+ in case etl of+ (Left _) -> (return $! TL.toStrict tl') `shouldThrow` anyException+ (Right tl) -> TL.fromChunks tl `shouldBe` tl' prop (enc ++ " encoding") $ \chars -> runIdentity $ runExceptionT_ $ do let tss = map T.pack chars lbs = tenc $ TL.fromChunks tss src = mconcat $ map (CL.sourceList . return) tss bss <- src C.$= CT.encode cenc C.$$ CL.consume return $ L.fromChunks bss == lbs- go "utf8" TLE.encodeUtf8 CT.utf8- go "utf16_le" TLE.encodeUtf16LE CT.utf16_le- go "utf16_be" TLE.encodeUtf16BE CT.utf16_be- go "utf32_le" TLE.encodeUtf32LE CT.utf32_le- go "utf32_be" TLE.encodeUtf32BE CT.utf32_be+ go "utf8" TLE.encodeUtf8 TLE.decodeUtf8 CT.utf8+ go "utf16_le" TLE.encodeUtf16LE TLE.decodeUtf16LE CT.utf16_le+ go "utf16_be" TLE.encodeUtf16BE TLE.decodeUtf16BE CT.utf16_be+ go "utf32_le" TLE.encodeUtf32LE TLE.decodeUtf32LE CT.utf32_le+ go "utf32_be" TLE.encodeUtf32BE TLE.decodeUtf32BE CT.utf32_be describe "text lines" $ do it "works across split lines" $