mockery 0.2.1 → 0.3.0
raw patch · 3 files changed
+11/−2 lines, 3 filesdep +filepathPVP ok
version bump matches the API change (PVP)
Dependencies added: filepath
API changes (from Hackage documentation)
Files
mockery.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: mockery-version: 0.2.1+version: 0.3.0 synopsis: Support functions for automated testing description: Support functions for automated testing category: Testing@@ -30,6 +30,7 @@ , bytestring , temporary , directory+ , filepath , logging-facade ghc-options: -Wall default-language: Haskell2010@@ -46,6 +47,7 @@ , bytestring , temporary , directory+ , filepath , logging-facade , mockery
src/Test/Mockery/Directory.hs view
@@ -8,6 +8,7 @@ import Control.Exception import Control.Monad import System.Directory+import System.FilePath import System.IO.Error import System.IO hiding (withFile) import System.IO.Temp (withSystemTempDirectory, withSystemTempFile)@@ -47,9 +48,11 @@ action file -- |--- Update the modification time of the specified file. Create an empty file if+-- Update the modification time of the specified file.+-- Create an empty file (including any missing directories in the file path) if -- the file does not exist. touch :: FilePath -> IO () touch file = do+ createDirectoryIfMissing True (takeDirectory file) c <- catchJust (guard . isDoesNotExistError) (B.readFile file) (const $ return B.empty) B.writeFile file c
test/Test/Mockery/DirectorySpec.hs view
@@ -27,6 +27,10 @@ touch name readFile name `shouldReturn` "" + it "creates any missing directories" $ do+ touch "foo/bar/baz"+ readFile "foo/bar/baz" `shouldReturn` ""+ context "when file already exists" $ do before_ (writeFile name "bar") $ do it "updates modification time" $ do