Commit 1929acb0 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Check that sandbox exists before running 'sandbox delete'.

parent 22481252
......@@ -8,7 +8,9 @@ import PackageTests.PackageTester
import Test.Framework as TF (Test)
import Test.Framework.Providers.HUnit (testCase)
import System.FilePath ((</>))
import Control.Monad (void, when)
import System.Directory (doesDirectoryExist)
import System.FilePath ((</>))
dir :: FilePath
dir = "PackageTests" </> "MultipleSource"
......@@ -16,8 +18,9 @@ dir = "PackageTests" </> "MultipleSource"
tests :: FilePath -> [TF.Test]
tests cabalPath =
[ testCase "finds second source of multiple source" $ do
-- can fail if there is no pre-existing sandbox
_ <- cabal_sandbox dir ["delete"] cabalPath
sandboxExists <- doesDirectoryExist $ dir </> ".cabal-sandbox"
when sandboxExists $
void $ cabal_sandbox dir ["delete"] cabalPath
assertSandboxSucceeded =<< cabal_sandbox dir ["init"] cabalPath
assertSandboxSucceeded =<< cabal_sandbox dir ["add-source", "p"] cabalPath
assertSandboxSucceeded =<< cabal_sandbox dir ["add-source", "q"] cabalPath
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment