extra 1.5.3 → 1.6
raw patch · 7 files changed
+16/−33 lines, 7 filesdep ~QuickCheckPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck
API changes (from Hackage documentation)
- Extra: subtractTime :: UTCTime -> UTCTime -> Seconds
- System.Time.Extra: subtractTime :: UTCTime -> UTCTime -> Seconds
Files
- CHANGES.txt +3/−0
- extra.cabal +2/−3
- src/Extra.hs +1/−1
- src/System/IO/Extra.hs +1/−1
- src/System/Time/Extra.hs +0/−12
- test/TestGen.hs +1/−1
- test/TestUtil.hs +8/−15
CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for Extra +1.6+ #23, delete subtractTime+ Require QuickCheck-2.10 1.5.3 Add readMaybe, readEither 1.5.2
extra.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.18 build-type: Simple name: extra-version: 1.5.3+version: 1.6 license: BSD3 license-file: LICENSE category: Development@@ -69,8 +69,7 @@ filepath, extra, clock >= 0.7,- time,- QuickCheck >= 2.9+ QuickCheck >= 2.10 if !os(windows) build-depends: unix hs-source-dirs: test
src/Extra.hs view
@@ -53,7 +53,7 @@ system_, systemOutput, systemOutput_, -- * System.Time.Extra -- | Extra functions available in @"System.Time.Extra"@.- Seconds, sleep, timeout, subtractTime, showDuration, offsetTime, offsetTimeIncrease, duration,+ Seconds, sleep, timeout, showDuration, offsetTime, offsetTimeIncrease, duration, -- * Text.Read.Extra -- | Extra functions available in @"Text.Read.Extra"@. readEither, readMaybe,
src/System/IO/Extra.hs view
@@ -103,7 +103,7 @@ -- | Write a binary file. ----- > \s -> withTempFile $ \file -> do writeFileBinary file s; fmap (== s) $ readFileBinary' file+-- > \(ASCIIString s) -> withTempFile $ \file -> do writeFileBinary file s; fmap (== s) $ readFileBinary' file writeFileBinary :: FilePath -> String -> IO () writeFileBinary file x = withBinaryFile file WriteMode $ \h -> hPutStr h x
src/System/Time/Extra.hs view
@@ -8,13 +8,11 @@ module System.Time.Extra( Seconds, sleep, timeout,- subtractTime, showDuration, offsetTime, offsetTimeIncrease, duration ) where import Control.Concurrent-import Data.Time.Clock import System.Clock import Numeric.Extra import Control.Monad.Extra@@ -70,16 +68,6 @@ (bracket (forkIOWithUnmask $ \unmask -> unmask $ sleep n >> throwTo pid ex) killThread (\_ -> fmap Just f))----- Once we remove subtractTime we can remove the dependency on the time package entire.-{-# DEPRECATED subtractTime "Function is being retired - use diffUTCTime directly." #-}---- | Calculate the difference between two times in seconds.--- Usually the first time will be the end of an event, and the--- second time will be the beginning.-subtractTime :: UTCTime -> UTCTime -> Seconds-subtractTime end start = fromRational $ toRational $ end `diffUTCTime` start -- | Show a number of seconds, typically a duration, in a suitable manner with
test/TestGen.hs view
@@ -224,7 +224,7 @@ testGen "isWindows == (os == \"mingw32\")" $ isWindows == (os == "mingw32") testGen "\\(filter isHexDigit -> s) -> fmap (== s) $ withTempFile $ \\file -> do writeFile file s; readFile' file" $ \(filter isHexDigit -> s) -> fmap (== s) $ withTempFile $ \file -> do writeFile file s; readFile' file testGen "\\s -> withTempFile $ \\file -> do writeFileUTF8 file s; fmap (== s) $ readFileUTF8' file" $ \s -> withTempFile $ \file -> do writeFileUTF8 file s; fmap (== s) $ readFileUTF8' file- testGen "\\s -> withTempFile $ \\file -> do writeFileBinary file s; fmap (== s) $ readFileBinary' file" $ \s -> withTempFile $ \file -> do writeFileBinary file s; fmap (== s) $ readFileBinary' file+ testGen "\\(ASCIIString s) -> withTempFile $ \\file -> do writeFileBinary file s; fmap (== s) $ readFileBinary' file" $ \(ASCIIString s) -> withTempFile $ \file -> do writeFileBinary file s; fmap (== s) $ readFileBinary' file testGen "captureOutput (print 1) == return (\"1\\n\",())" $ captureOutput (print 1) == return ("1\n",()) testGen "withTempFile doesFileExist == return True" $ withTempFile doesFileExist == return True testGen "(doesFileExist =<< withTempFile return) == return False" $ (doesFileExist =<< withTempFile return) == return False
test/TestUtil.hs view
@@ -1,6 +1,13 @@ {-# LANGUAGE ScopedTypeVariables, CPP, FlexibleInstances #-} -module TestUtil(runTests, testGen, testRaw, erroneous, erroneousIO, (====), module X) where+module TestUtil+ (runTests+ ,testGen, testRaw+ ,erroneous, erroneousIO+ ,(====)+ ,ASCIIString(..)+ ,module X+ ) where import Test.QuickCheck import Test.QuickCheck.Test@@ -10,8 +17,6 @@ import Data.Version.Extra import Data.IORef import System.IO.Unsafe-import Data.Time.Clock-import Data.Time.Calendar import Text.Show.Functions() import Extra as X@@ -70,9 +75,6 @@ n <- readIORef testCount putStrLn $ "Success (" ++ show n ++ " tests)" -instance Testable () where- property = property . (`seq` True)- instance Testable a => Testable (IO a) where property = property . unsafePerformIO @@ -95,12 +97,3 @@ instance Eq SomeException where a == b = show a == show b--instance Arbitrary UTCTime where- arbitrary = liftM2 UTCTime arbitrary arbitrary--instance Arbitrary Day where- arbitrary = fmap ModifiedJulianDay arbitrary--instance Arbitrary DiffTime where- arbitrary = realToFrac <$> choose (0 :: Double, 86401)