packages feed

text-ldap 0.1.1.2 → 0.1.1.3

raw patch · 5 files changed

+76/−38 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

+ test/Error.hs view
@@ -0,0 +1,8 @@+module Error (qcEither) where++import Test.QuickCheck (Result (Success))++qcEither :: Test.QuickCheck.Result -> Either String ()+qcEither =  d  where+  d (Success {}) = Right ()+  d x            = Left $ show x
test/PrintParse.hs view
@@ -1,15 +1,12 @@ {-# OPTIONS -fno-warn-orphans #-} {-# LANGUAGE FlexibleInstances #-} -module PrintParse (tests) where+module PrintParse (ppTests) where -import Distribution.TestSuite-  (Test (Test), TestInstance (TestInstance), Result (Pass, Fail), Progress (Finished))+import Distribution.TestSuite (Test) import Test.QuickCheck-  (Testable, Gen, Arbitrary (..), Result (Success),-   choose, oneof, frequency, elements, quickCheckResult)+  (Gen, Arbitrary (..), choose, oneof, frequency, elements) -import Control.Exception (try) import Control.Applicative ((<$>), (<*>)) import Data.ByteString.Char8 (ByteString, pack) import Text.LDAP.Data@@ -21,27 +18,7 @@ import qualified Text.LDAP.Parser as Parser import Data.List.NonEmpty (NonEmpty ((:|))) --simpleInstance :: IO Progress -> String -> Test-simpleInstance p name = Test this  where-  this = TestInstance p name [] [] (\_ _ -> Right this)--qresult :: Test.QuickCheck.Result -> Either String ()-qresult =  d  where-  d (Success {}) = Right ()-  d x            = Left $ show x--showIOError :: Either IOError a -> Either String a-showIOError =  d  where-  d (Right x) = Right x-  d (Left e)  = Left $ show e--testSuite :: Testable prop => prop -> String -> Test-testSuite t = simpleInstance $ do-  e <- try $ quickCheckResult t-  return . Finished . either Fail (const Pass) $ do-    qr <- showIOError e-    qresult qr+import Suite (suite)   list :: Gen a -> Int -> Gen [a]@@ -134,12 +111,11 @@   (Printer.openLdapEntry Printer.ldifEncodeAttrValue)   (Parser.openLdapEntry  Parser.ldifDecodeAttrValue) -tests :: IO [Test]-tests =-  return-  [ testSuite prop_attributeIso "attribute iso - print parse"-  , testSuite prop_componentIso "component iso - print parse"-  , testSuite prop_dnIso "dn iso - print parse"-  , testSuite prop_ldifAttrIso "ldifAttr iso - print parse"-  , testSuite prop_openLdapEntryIso "openLdapEntry iso - print parse"+ppTests :: [Test]+ppTests =+  [ suite prop_attributeIso "attribute iso - print parse"+  , suite prop_componentIso "component iso - print parse"+  , suite prop_dnIso "dn iso - print parse"+  , suite prop_ldifAttrIso "ldifAttr iso - print parse"+  , suite prop_openLdapEntryIso "openLdapEntry iso - print parse"   ]
+ test114/Suite.hs view
@@ -0,0 +1,35 @@+module Suite (suite) where++import Distribution.TestSuite+  (TestOptions (..), Options (..), ImpureTestable (..), impure,+   Test, Result (Pass, Fail, Error))+import qualified Distribution.TestSuite as TestSuite+import Test.QuickCheck (Testable, quickCheckResult)++import Control.Exception (try)+import Control.Applicative ((<$>))++import Error (qcEither)+++test114 :: Testable prop => prop -> IO TestSuite.Result+test114 t = do+  er <- try (qcEither <$> quickCheckResult t)+  return $ case er of+    Right (Right ()) -> Pass+    Right (Left m)   -> Fail m+    Left e           -> Error $ show (e :: IOError)++data Suite114 t = Suite114 String t++instance Testable prop => TestOptions (Suite114 prop) where+  name (Suite114 n _) = n+  options = const []+  defaultOptions = const . return $ Options []+  check _ _ = []++instance Testable prop => ImpureTestable (Suite114 prop) where+  runM (Suite114 _ t) _ = test114 t++suite :: Testable prop => prop -> String -> Test+suite t n = impure $ Suite114 n t
+ test114/Tests.hs view
@@ -0,0 +1,8 @@+module Tests (tests) where++import Distribution.TestSuite (Test)++import PrintParse (ppTests)++tests :: [Test]+tests =  ppTests
text-ldap.cabal view
@@ -1,6 +1,6 @@  name:                text-ldap-version:             0.1.1.2+version:             0.1.1.3 synopsis:            Parser and Printer for LDAP text data stream description:         This package contains Parser and Printer for                      LDAP text data stream like OpenLDAP backup LDIF.@@ -52,6 +52,10 @@   ghc-options:         -Wall -rtsopts   ghc-prof-options:    -prof -fprof-auto +flag test-cabal114+  description: This flag make sense when Cabal 1.14 is used.+               If true, use Cabal 1.14 test-suite interface.+  default:     False  Test-suite pp   build-depends:         base <5@@ -63,8 +67,15 @@                        , Cabal    type:                detailed-0.9-  test-module:         PrintParse-  hs-source-dirs:      test+  test-module:         Tests+  other-modules:+                       Error+                       Suite+                       PrintParse+  if flag(test-cabal114)+    hs-source-dirs:      test, test114+  else+    hs-source-dirs:      test, test118   ghc-options:         -Wall  source-repository head