hOpenPGP 0.3 → 0.3.1
raw patch · 2 files changed
+7/−31 lines, 2 filesdep ~cereal-conduitPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: cereal-conduit
API changes (from Hackage documentation)
Files
- hOpenPGP.cabal +3/−3
- tests/suite.hs +4/−28
hOpenPGP.cabal view
@@ -1,5 +1,5 @@ Name: hOpenPGP-Version: 0.3+Version: 0.3.1 Synopsis: native Haskell implementation of OpenPGP (RFC4880) Description: native Haskell implementation of OpenPGP (RFC4880) Homepage: http://floss.scru.org/hOpenPGP/@@ -118,7 +118,7 @@ , bytestring , bzlib , cereal- , cereal-conduit > 0.0.6 && < 0.1+ , cereal-conduit >= 0.5 && < 0.6 , conduit > 0.4 && < 0.5 , containers , cryptocipher@@ -140,7 +140,7 @@ , bytestring , bzlib , cereal- , cereal-conduit > 0.0.6 && < 0.1+ , cereal-conduit >= 0.5 && < 0.6 , conduit > 0.4 && < 0.5 , containers , cryptocipher
tests/suite.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE FlexibleContexts, UndecidableInstances #-} import Test.Framework (defaultMain, testGroup) import Test.Framework.Providers.HUnit@@ -32,17 +31,6 @@ import qualified Data.Conduit.Binary as CB import qualified Data.Conduit.List as CL --- cope with instance problem for now-instance (DC.MonadResource m, DC.MonadThrow (ExceptionT m)) => DC.MonadResource (ExceptionT m) where- allocate a = lift . allocate a- register = lift . register- release = lift . release- resourceMask = lift . resourceMask--instance Monad a => DC.MonadThrow (ExceptionT a) where- monadThrow = throw---- testSerialization :: FilePath -> Assertion testSerialization fp = do bs <- B.readFile $ "tests/data/" ++ fp@@ -88,26 +76,14 @@ testKeyringLookup :: FilePath -> String -> Bool -> Assertion testKeyringLookup fp eok expected = do- -- kr <- DC.runResourceT $ CB.sourceFile ("tests/data/" ++ fp) DC.$= conduitGet get DC.$= conduitToKRKs DC.$$ sinkKeyringMap- -- let key = (Map.lookup (read eok) kr)- kr <- DC.runResourceT $ runExceptionT $ (CB.sourceFile ("tests/data/" ++ fp) DC.$= conduitGet get DC.$= conduitToKRKs DC.$$ sinkKeyringMap :: ExceptionT (DC.ResourceT IO) (Map.Map EightOctetKeyId KRK))- let key = case kr of- Left e -> Nothing- Right k -> Map.lookup (read eok) k+ kr <- DC.runResourceT $ CB.sourceFile ("tests/data/" ++ fp) DC.$= conduitGet get DC.$= conduitToKRKs DC.$$ sinkKeyringMap+ let key = (Map.lookup (read eok) kr) assertEqual (eok ++ " in " ++ fp) expected (isJust key) testVerifyMessage :: FilePath -> FilePath -> Assertion testVerifyMessage keyring message = do- -- kr <- DC.runResourceT $ CB.sourceFile ("tests/data/" ++ keyring) DC.$= conduitGet get DC.$= conduitToKRKs DC.$$ sinkKeyringMap- -- verification <- DC.runResourceT $ CB.sourceFile ("tests/data/" ++ message) DC.$= conduitGet get DC.$= conduitDecompress DC.$= conduitVerify kr DC.$$ CL.consume- kring <- DC.runResourceT $ runExceptionT $ (CB.sourceFile ("tests/data/" ++ keyring) DC.$= conduitGet get DC.$= conduitToKRKs DC.$$ sinkKeyringMap :: ExceptionT (DC.ResourceT IO) (Map.Map EightOctetKeyId KRK))- let kr = case kring of- Left e -> Map.empty- Right k -> k- verif <- DC.runResourceT $ runExceptionT $ (CB.sourceFile ("tests/data/" ++ message) DC.$= conduitGet get DC.$= conduitDecompress DC.$= conduitVerify kr DC.$$ CL.consume :: ExceptionT (DC.ResourceT IO) [Either String Bool])- let verification = case verif of- Left e -> []- Right xs -> xs+ kr <- DC.runResourceT $ CB.sourceFile ("tests/data/" ++ keyring) DC.$= conduitGet get DC.$= conduitToKRKs DC.$$ sinkKeyringMap+ verification <- DC.runResourceT $ CB.sourceFile ("tests/data/" ++ message) DC.$= conduitGet get DC.$= conduitDecompress DC.$= conduitVerify kr DC.$$ CL.consume assertEqual (keyring ++ " for " ++ message) ([Right True]) verification tests = [