siphon 0.8.1.1 → 0.8.1.2
raw patch · 5 files changed
+32/−7 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- siphon.cabal +5/−4
- src/Siphon.hs +10/−2
- test/Doctest.hs +2/−1
- test/Test.hs +10/−0
+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# Revision history for siphon++## 0.8.1.2 -- 2021-10-25++* Correct handling of CRLF.
siphon.cabal view
@@ -1,16 +1,17 @@+cabal-version: 3.0 name: siphon-version: 0.8.1.1+version: 0.8.1.2 synopsis: Encode and decode CSV files description: Please see README.md homepage: https://github.com/andrewthad/colonnade#readme-license: BSD3+license: BSD-3-Clause license-file: LICENSE author: Andrew Martin maintainer: andrew.thaddeus@gmail.com copyright: 2016 Andrew Martin category: web build-type: Simple-cabal-version: >=1.10+extra-source-files: CHANGELOG.md library hs-source-dirs: src@@ -25,7 +26,7 @@ , vector , streaming >= 0.1.4 && < 0.3 , attoparsec- , transformers >= 0.5 && < 0.6+ , transformers >= 0.4.2 && < 0.6 , semigroups >= 0.18.2 && < 0.20 default-language: Haskell2010
src/Siphon.hs view
@@ -388,7 +388,11 @@ trailChar <- case mb of Just b | b == comma -> A.anyWord8 >> return TrailCharComma- | b == newline || b == cr -> A.anyWord8 >> return TrailCharNewline+ | b == newline -> A.anyWord8 >> return TrailCharNewline+ | b == cr -> do+ _ <- A.anyWord8+ _ <- A.word8 newline+ return TrailCharNewline | otherwise -> fail "encountered double quote after escaped field" Nothing -> return TrailCharEnd if doubleQuote `S.elem` s@@ -412,7 +416,11 @@ case mb of Just b | b == comma -> A.anyWord8 >> return (bs,TrailCharComma)- | b == newline || b == cr -> A.anyWord8 >> return (bs,TrailCharNewline)+ | b == newline -> A.anyWord8 >> return (bs,TrailCharNewline)+ | b == cr -> do+ _ <- A.anyWord8+ _ <- A.word8 newline+ return (bs,TrailCharNewline) | otherwise -> fail "encountered double quote in unescaped field" Nothing -> return (bs,TrailCharEnd)
test/Doctest.hs view
@@ -2,6 +2,7 @@ main :: IO () main = doctest- [ "src/Siphon.hs"+ [ "-isrc"+ , "src/Siphon.hs" ]
test/Test.hs view
@@ -108,6 +108,16 @@ ] ) ) @?= (["drew","martin, drew"] :> Nothing)+ , testCase "Headed Decoding (escaped characters, character per chunk, CRLF)"+ $ ( runIdentity . SMP.toList )+ ( S.decodeCsvUtf8 decodingF+ ( mapM_ (SMP.yield . BC8.singleton) $ concat+ [ "name\r\n"+ , "drew\r\n"+ , "\"martin, drew\"\r\n"+ ]+ )+ ) @?= (["drew","martin, drew"] :> Nothing) , testProperty "Headed Isomorphism (int,char,bool)" $ propIsoStream BC8.unpack (S.decodeCsvUtf8 decodingB)