purebred-email 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+39/−5 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- purebred-email.cabal +2/−2
- src/Data/MIME.hs +1/−1
- test-vectors/nested-multipart.eml +16/−0
- tests/MIME.hs +20/−2
purebred-email.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: purebred-email-version: 0.1.0.0+version: 0.1.0.1 synopsis: types and parser for email messages (including MIME) description: The purebred email library. RFC 5322, MIME, etc.@@ -35,7 +35,7 @@ tests/golden/*.golden cabal-version: >=1.10 tested-with:- GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.3+ GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.1 homepage: https://github.com/purebred-mua/purebred-email bug-reports: https://github.com/purebred-mua/purebred-email/issues
src/Data/MIME.hs view
@@ -613,7 +613,7 @@ multipartBody = skipTillString dashBoundary *> crlf -- FIXME transport-padding *> part `sepBy` crlf- <* string "--" <* crlf <* void takeTillEnd+ <* string "--" <* takeTillEnd -- | Serialise a given `MIMEMessage` into a ByteString. The message is -- serialised as is. No additional headers are set.
+ test-vectors/nested-multipart.eml view
@@ -0,0 +1,16 @@+Content-Type: multipart/mixed; boundary=boundary1+MIME-Version: 1.0+Date: Thu, 4 May 2017 03:08:43 +1000 (EST)+From: foo@bar+To: my@email.test+Subject: Pretty subject++--boundary1+Content-Type: multipart/alternative; boundary=boundary2++--boundary2+Content-Type: text/plain++Bla bla bla+--boundary2--+--boundary1--
tests/MIME.hs view
@@ -19,20 +19,28 @@ module MIME where +import Control.Monad ((<=<), void) import Data.Char (toUpper) import Control.Lens+import qualified Data.ByteString as B import qualified Data.Text as T import Test.Tasty (TestTree, testGroup)-import Test.Tasty.HUnit ((@?=), testCase)+import Test.Tasty.HUnit ((@?=), Assertion, assertFailure, testCase) import Test.Tasty.QuickCheck import Test.QuickCheck.Instances () import Data.MIME unittests :: TestTree-unittests =+unittests = testGroup "MIME tests"+ [ testContentDisposition+ , testParse+ ]++testContentDisposition :: TestTree+testContentDisposition = testGroup "content disposition" [ testCase "read empty (plain; should fail)" $ preview lFilename@@ -133,3 +141,13 @@ where lFilename = headers . contentDisposition . filename stripPath = snd . T.breakOnEnd "/"++testParse :: TestTree+testParse = testGroup "parsing tests"+ [ testCase "nested multipart" $+ testParseFile "test-vectors/nested-multipart.eml"+ ]++testParseFile :: FilePath -> Assertion+testParseFile =+ either assertFailure (void . pure) . parse (message mime) <=< B.readFile