diff options
Diffstat (limited to 'dev-haskell/certificate/files/certificate-1.3.6/Tests/Unit.hs')
-rw-r--r-- | dev-haskell/certificate/files/certificate-1.3.6/Tests/Unit.hs | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/dev-haskell/certificate/files/certificate-1.3.6/Tests/Unit.hs b/dev-haskell/certificate/files/certificate-1.3.6/Tests/Unit.hs deleted file mode 100644 index d97947f2b233..000000000000 --- a/dev-haskell/certificate/files/certificate-1.3.6/Tests/Unit.hs +++ /dev/null @@ -1,46 +0,0 @@ -module Tests.Unit - ( runTests - ) where - -import System.Directory -import Test.HUnit -import Control.Monad -import Control.Applicative ((<$>)) -import Control.Exception -import qualified Data.ByteString as B -import qualified Data.ByteString.Lazy as L -import Data.Certificate.X509 -import Data.List (isPrefixOf) - --- FIXME : make unit tests portable to run on osX and windows -import System.Certificate.X509 -import Data.CertificateStore - -checkCert (X509 c mraw rawCert sigalg sigbits) = do - let errs = - (checkSigAlg $ certSignatureAlg c) ++ - (checkPubKey $ certPubKey c) ++ - (checkExtensions $ certExtensions c) ++ - (checkBodyRaw rawCert mraw) - when (errs /= []) $ do - putStrLn ("error decoding") - mapM_ (putStrLn . (" " ++)) errs - where - checkExtensions ext = [] - - checkSigAlg (SignatureALG_Unknown oid) = ["unknown signature algorithm " ++ show oid] - checkSigAlg _ = [] - - checkPubKey (PubKeyUnknown oid _) = ["unknown public key alg " ++ show (certPubKey c)] - checkPubKey _ = [] - - checkBodyRaw (Just x) (Just y) = if findsubstring y x then [] else ["cannot find body cert in original raw file"] - checkBodyRaw _ _ = [] - - findsubstring a b - | L.null b = False - | a `L.isPrefixOf` b = True - | otherwise = findsubstring a (L.drop 1 b) - -runTests :: IO () -runTests = getSystemCertificateStore >>= mapM_ checkCert . listCertificates |