test-framework-sandbox 0.0.2.3 → 0.0.2.4
raw patch · 3 files changed
+14/−20 lines, 3 filesdep ~test-sandboxnew-uploader
Dependency ranges changed: test-sandbox
Files
- src/Test/Framework/Providers/Sandbox.hs +5/−10
- src/Test/Framework/Providers/Sandbox/Internals.hs +3/−6
- test-framework-sandbox.cabal +6/−4
src/Test/Framework/Providers/Sandbox.hs view
@@ -26,11 +26,6 @@ import Control.Exception.Lifted import Control.Monad hiding (fail) import Control.Monad.Reader (ask)-import Control.Monad.Trans.Error (runErrorT)-import Control.Monad.Trans.Reader (runReaderT)-import Data.Either-import Prelude hiding (error, fail)-import qualified Prelude (error) import System.Console.ANSI import System.Environment import System.Exit@@ -55,9 +50,9 @@ if isExcluded options name then return $ Test name (SandboxTest Skipped) else withSystemTempDirectory (name ++ "_") $ \dir -> do env <- newSandboxState name dir- result <- (runReaderT . runErrorT . runSandbox) (putOptions options >> sandboxTestGroup name tests `finally` stopAll) env+ result <- runSandbox (putOptions options >> sandboxTestGroup name tests `finally` stopAll) env case result of- Left error -> return $ Test name (SandboxTest (Failure error))+ Left error' -> return $ Test name (SandboxTest (Failure error')) Right x -> return x ] @@ -88,10 +83,10 @@ sandboxTest name test = withTest name $ do res <- do ref <- ask- liftIO $ flip (runReaderT . runErrorT . runSandbox) ref $ test `catches` handlers+ liftIO $ flip runSandbox ref $ test `catches` handlers liftIO $ printTestResult res case res of- Left error -> return $ Test name (SandboxTest (Failure error))+ Left error' -> return $ Test name (SandboxTest (Failure error')) Right _ -> return $ Test name (SandboxTest Passed) where handlers = [ Handler exitHandler , Handler interruptHandler@@ -110,7 +105,7 @@ yieldProgress p = do pl <- getVariable prettyPrintVariable [] unless (null pl) $ liftIO $ putStr " / "- setVariable prettyPrintVariable (p : pl)+ _ <- setVariable prettyPrintVariable (p : pl) liftIO $ putStrColor Dull Blue p >> hFlush stdout ----------------------------------------------------------------------
src/Test/Framework/Providers/Sandbox/Internals.hs view
@@ -10,10 +10,7 @@ import Control.Concurrent import Control.Monad hiding (fail)-import Data.Either import Data.Typeable-import Prelude hiding (error, fail)-import qualified Prelude (error) import System.Console.ANSI import System.IO @@ -53,14 +50,14 @@ instance Testlike SandboxTestRunning SandboxTestResult SandboxTest where testTypeName _ = "Sandbox tests" runTest _ (SandboxTest res) = runImprovingIO $ return res- runTest _ (SandboxCleaning mvar) = runImprovingIO $ do TF.liftIO $ takeMVar mvar+ runTest _ (SandboxCleaning mvar) = runImprovingIO $ do _ <- TF.liftIO $ takeMVar mvar -- ToDo: Why this return-value is dicarded? return Passed withTest :: String -> Sandbox b -> Sandbox b withTest name action = withVariable testVariable name $ bracket (do level <- getVariable testLevelVariable 0 liftIO $ printTestName level name- setVariable testLevelVariable $! level + 1+ _ <- setVariable testLevelVariable $! level + 1 return level) (setVariable testLevelVariable) (const action)@@ -84,7 +81,7 @@ printTestResult :: Either String a -> IO () printTestResult r = case r of- Left error -> putStr " [" >> putStrColor Vivid Red "Fail" >> putStrLn ("] " ++ error)+ Left error' -> putStr " [" >> putStrColor Vivid Red "Fail" >> putStrLn ("] " ++ error') _ -> putStr " [" >> putStrColor Vivid Green "OK" >> putStrLn "]" putStrColor :: ColorIntensity -> Color -> String -> IO ()
test-framework-sandbox.cabal view
@@ -1,5 +1,5 @@ Name: test-framework-sandbox-Version: 0.0.2.3+Version: 0.0.2.4 Cabal-Version: >= 1.14 Category: Testing Synopsis: test-sandbox support for the test-framework package@@ -13,7 +13,7 @@ <http://gree.github.io/haskell-test-sandbox/> . A full example project is available at:- <https://git.gree-dev.net/benjamin-surma/flare-tests/>+ <https://git.github.com/benjamin-surma/flare-tests/> . Extensive documentation is available in the source code itself. License: BSD3@@ -29,16 +29,18 @@ Source-Repository this Type: git Location: https://github.com/gree/haskell-test-sandbox- Tag: test-framework-sandbox_0.0.2.3+ Tag: test-framework-sandbox_0.0.2.4 Library Exposed-modules: Test.Framework.Providers.Sandbox Test.Framework.Providers.Sandbox.Internals Build-Depends: base >=4 && <5, ansi-terminal, lifted-base, mtl,- temporary, test-framework >=0.8.0.3, test-sandbox >=0.0.1.5 && <0.0.2,+ temporary, test-framework >=0.8.0.3, test-sandbox >=0.0.1.9 && <0.0.2, transformers Hs-source-dirs: src Default-Language: Haskell2010++ ghc-options: -Wall