mockery (empty) → 0.0.0
raw patch · 5 files changed
+99/−0 lines, 5 filesdep +basedep +directorydep +hspecsetup-changed
Dependencies added: base, directory, hspec, mockery, temporary
Files
- LICENSE +19/−0
- Setup.lhs +3/−0
- mockery.cabal +46/−0
- src/Test/Mockery/Directory.hs +30/−0
- test/Spec.hs +1/−0
+ LICENSE view
@@ -0,0 +1,19 @@+Copyright (c) 2015 Simon Hengel <sol@typeful.net>++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in+all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+THE SOFTWARE.
+ Setup.lhs view
@@ -0,0 +1,3 @@+#!/usr/bin/env runhaskell+> import Distribution.Simple+> main = defaultMain
+ mockery.cabal view
@@ -0,0 +1,46 @@+-- This file has been generated from package.yaml by hpack.+--+-- see: https://github.com/sol/hpack++name: mockery+version: 0.0.0+synopsis: Support functions for automated testing+description: Support functions for automated testing+category: Testing+bug-reports: https://github.com/sol/mockery/issues+author: Simon Hengel <sol@typeful.net>+maintainer: Simon Hengel <sol@typeful.net>+copyright: (c) 2015 Simon Hengel+license: MIT+license-file: LICENSE+build-type: Simple+cabal-version: >= 1.10++source-repository head+ type: git+ location: https://github.com/sol/mockery++library+ hs-source-dirs: src+ exposed-modules:+ Test.Mockery.Directory+ build-depends:+ base == 4.*+ , temporary+ , directory+ ghc-options: -Wall+ default-language: Haskell2010++test-suite spec+ type: exitcode-stdio-1.0+ hs-source-dirs: test+ main-is: Spec.hs+ build-depends:+ base == 4.*+ , temporary+ , directory++ , mockery+ , hspec == 2.*+ ghc-options: -Wall+ default-language: Haskell2010
+ src/Test/Mockery/Directory.hs view
@@ -0,0 +1,30 @@+module Test.Mockery.Directory (+ inTempDirectory+, inTempDirectoryNamed+) where++import Control.Exception+import System.Directory+import System.IO.Temp (withSystemTempDirectory)++-- |+-- Run given action with the current working directory set to a temporary+-- directory.+--+-- The directory is created before the action is run. After the action has+-- completed the directory is removed and the current working directory is+-- restored to its original value.+inTempDirectory :: IO a -> IO a+inTempDirectory action = withSystemTempDirectory "hspec" $ \path -> do+ bracket getCurrentDirectory setCurrentDirectory $ \_ -> do+ setCurrentDirectory path+ action++-- |+-- Similar to `inTempDirectory`, but the temporary directory will have the+-- specified name.+inTempDirectoryNamed :: FilePath -> IO a -> IO a+inTempDirectoryNamed name action = inTempDirectory $ do+ createDirectory name+ setCurrentDirectory name+ action
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}