packages feed

happstack-util 0.4.1 → 0.5.0

raw patch · 6 files changed

+45/−35 lines, 6 filesdep ~QuickCheckdep ~SMTPClientsetup-changedPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: QuickCheck, SMTPClient

API changes (from Hackage documentation)

- Happstack.Util.Testing: qccheck :: (Testable a) => Config -> a -> Test
- Happstack.Util.Testing: qcrun :: (Testable a) => a -> TestOptions -> Test
- Happstack.Util.Testing: qctest :: (Testable a) => a -> Test

Files

Setup.hs view
@@ -1,3 +1,3 @@ #!/usr/bin/env runhaskell import Distribution.Simple-main = defaultMainWithHooks defaultUserHooks+main = defaultMainWithHooks simpleUserHooks
happstack-util.cabal view
@@ -1,5 +1,5 @@ Name:                happstack-util-Version:             0.4.1+Version:             0.5.0 Synopsis:            Web framework License:             BSD3 License-file:        COPYING@@ -35,10 +35,8 @@                        parsec < 3,                        process,                        time,-                       QuickCheck < 2,-                       HUnit,                        random,-                       SMTPClient >= 1.0.1 && < 1.1,+                       SMTPClient >= 1.0.2 && < 1.1,                        strict-concurrency,                        network >= 2.2 && < 3,                        template-haskell,@@ -74,11 +72,14 @@                        Happstack.Util.OpenExclusively,                        Happstack.Util.TimeOut,                        Happstack.Util.TH,-                       Happstack.Util.Testing,                        Happstack.Util.FileManip   if flag(tests)-    Exposed-modules:   Happstack.Util.Tests-    Exposed-modules:   Happstack.Util.Tests.HostAddress+    Build-Depends:+                       QuickCheck >= 2 && < 3,+                       HUnit+    Exposed-modules:   Happstack.Util.Testing,+                       Happstack.Util.Tests,+                       Happstack.Util.Tests.HostAddress    extensions:          CPP, UndecidableInstances, BangPatterns, StandaloneDeriving,                        DeriveDataTypeable, TemplateHaskell, RecursiveDo
src/Happstack/Crypto/Base64.hs view
@@ -29,7 +29,6 @@  import Data.Array.Unboxed import Data.Bits-import Data.Int import Data.Char (chr,ord)  
src/Happstack/Util/FileManip.hs view
@@ -41,13 +41,12 @@ -- -- Example: ----- @--- myFoldFunc :: a -> 'FileInfo' -> a--- myFoldFunc a i = let useThisFile = 'evalClause' ('fileName' '==?' \"foo\") i---                  in if useThisFile---                     then fiddleWith a---                     else a--- @+-- > myFoldFunc :: a -> FileInfo -> a+-- > myFoldFunc a i = let useThisFile = evalClause (fileName ==? "foo") i+-- >                  in if useThisFile+-- >                     then fiddleWith a+-- >                     else a+-- evalClause :: FindClause a -> FileInfo -> a evalClause = evalState . runFC @@ -83,20 +82,20 @@  findWithHandler errHandler recurse filter path =     E.handle (errHandler path) $ F.getSymbolicLinkStatus path >>= visit path 0-  where visit path depth st =-            if F.isDirectory st && evalFI recurse path depth st-              then unsafeInterleaveIO (traverse path (succ depth) st)-              else filterPath path depth st []+  where visit path' depth st =+            if F.isDirectory st && evalFI recurse path' depth st+              then unsafeInterleaveIO (traverse path' (succ depth) st)+              else filterPath path' depth st []         traverse dir depth dirSt = do             names <- E.catch (getDirContents dir) (errHandler dir)             filteredPaths <- forM names $ \name -> do-                let path = dir </> name-                unsafeInterleaveIO $ E.handle (errHandler path)-                    (F.getSymbolicLinkStatus path >>= visit path depth)+                let path' = dir </> name+                unsafeInterleaveIO $ E.handle (errHandler path')+                    (F.getSymbolicLinkStatus path >>= visit path' depth)             filterPath dir depth dirSt (concat filteredPaths)-        filterPath path depth st result =-            return $ if evalFI filter path depth st-                then path:result+        filterPath path' depth st result =+            return $ if evalFI filter path' depth st+                then path':result                 else result  -- | Search a directory recursively, with recursion controlled by a
src/Happstack/Util/Testing.hs view
@@ -1,18 +1,29 @@-module Happstack.Util.Testing (qctest, qccheck, qcrun) where+module Happstack.Util.Testing (qctest, qccheck) where -import Test.HUnit as HU-import Test.QuickCheck as QC-import Test.QuickCheck.Batch (TestResult(..),TestOptions(..),run)+import qualified Test.HUnit as HU+import qualified Test.QuickCheck as QC+-- import Test.QuickCheck.Batch (TestResult(..),TestOptions(..),run) import System.Random--qctest :: QC.Testable a => a -> Test-qctest = qccheck defaultConfig-+{- qccheck :: QC.Testable a => Config -> a -> Test qccheck config a = TestCase $   do rnd <- newStdGen      tests config (evaluate a) rnd 0 0 []+-} +qccheck :: QC.Testable a => QC.Args -> a -> HU.Test+qccheck args prop = +  HU.TestCase $+    do result <- QC.quickCheckWithResult args prop+       case result of+         (QC.Success _) -> return ()+         (QC.GaveUp ntest _) -> HU.assertFailure $ "Arguments exhausted after" ++ show ntest ++ (if ntest == 1 then " test." else " tests.")+         (QC.Failure _ usedSize reason _) -> HU.assertFailure reason+         (QC.NoExpectedFailure _) -> HU.assertFailure $ "No Expected Failure"++qctest :: QC.Testable a => a -> HU.Test+qctest = qccheck QC.stdArgs+{- qcrun :: QC.Testable a => a -> TestOptions -> Test qcrun prop opts = TestCase $     do res <- run prop opts@@ -50,3 +61,4 @@       result      = generate (configSize config ntest) rnd2 gen       (rnd1,rnd2) = split rnd0 +-}
src/Happstack/Util/TimeOut.hs view
@@ -51,7 +51,6 @@ import qualified Control.Concurrent.MVar.Strict as SM import Control.Exception.Extensible as E import Data.Typeable(Typeable)-import Data.Maybe import System.IO.Unsafe (unsafePerformIO) import Control.Monad (when)