Commit fe36cc2b authored by Lennart Spitzner's avatar Lennart Spitzner
Browse files

cabal-install/tests: Fix variable names; Remove printf debugging

parent a1692da9
......@@ -27,7 +27,7 @@ import Test.Framework (Test, defaultMain, testGroup)
import Control.Monad ( when )
-- Modules containing the tests.
import qualified PackageTests.PackageTester (checkBasePath)
import qualified PackageTests.PackageTester ( packageTestsDirectory )
import qualified PackageTests.Exec.Check
import qualified PackageTests.Freeze.Check
import qualified PackageTests.MultipleSource.Check
......@@ -59,10 +59,9 @@ main = do
putStrLn $ "Using cabal: " ++ cabalPath
putStrLn $ "Using ghc-pkg: " ++ ghcPkgPath
cwd <- getCurrentDirectory
let confFile = PackageTests.PackageTester.checkBasePath </> "cabal-config"
let confFile = PackageTests.PackageTester.packageTestsDirectory </> "cabal-config"
removeConf = do
b <- doesFileExist confFile
putStrLn confFile
when b $ removeFile confFile
let runTests = do
setCurrentDirectory "tests"
......
......@@ -16,10 +16,10 @@ import System.FilePath ((</>))
import System.Directory (getDirectoryContents)
dir :: FilePath
dir = checkBasePath </> "Exec"
dir = packageTestsDirectory </> "Exec"
configPath :: FilePath
configPath = checkDefaultConfigRelativePath
configPath = ".." </> packageTestsConfigFile
tests :: FilePath -> FilePath -> [TF.Test]
tests cabalPath ghcPkgPath =
......
......@@ -17,10 +17,10 @@ import System.FilePath ((</>))
import System.IO.Error (isDoesNotExistError)
dir :: FilePath
dir = checkBasePath </> "Freeze"
dir = packageTestsDirectory </> "Freeze"
configPath :: FilePath
configPath = checkDefaultConfigRelativePath
configPath = ".." </> packageTestsConfigFile
tests :: FilePath -> [TF.Test]
tests cabalPath =
......
......@@ -13,7 +13,7 @@ import System.Directory (doesDirectoryExist)
import System.FilePath ((</>))
dir :: FilePath
dir = checkBasePath </> "MultipleSource"
dir = packageTestsDirectory </> "MultipleSource"
tests :: FilePath -> [TF.Test]
tests cabalPath =
......@@ -22,7 +22,7 @@ tests cabalPath =
let execute cmd params = cmd dir
params
cabalPath
checkDefaultConfigRelativePath
(".." </> packageTestsConfigFile)
when sandboxExists $
void $ execute cabal_sandbox ["delete"]
assertSandboxSucceeded =<< execute cabal_sandbox ["init"]
......
......@@ -19,9 +19,8 @@
module PackageTests.PackageTester
( Result(..)
, checkBasePath
, checkDefaultConfigFile
, checkDefaultConfigRelativePath
, packageTestsDirectory
, packageTestsConfigFile
-- * Running cabal commands
, cabal_clean
......@@ -46,7 +45,7 @@ import Data.Maybe (fromMaybe)
import System.Directory (canonicalizePath, doesFileExist)
import System.Environment (getEnv)
import System.Exit (ExitCode(ExitSuccess))
import System.FilePath ( (<.>), (</>) )
import System.FilePath ( (<.>) )
import System.IO (hClose, hGetChar, hIsEOF)
import System.IO.Error (isDoesNotExistError)
import System.Process (runProcess, waitForProcess)
......@@ -82,14 +81,11 @@ nullResult = Result True Failure ""
------------------------------------------------------------------------
-- * Config
checkBasePath :: FilePath
checkBasePath = "PackageTests"
packageTestsDirectory :: FilePath
packageTestsDirectory = "PackageTests"
checkDefaultConfigFile :: FilePath
checkDefaultConfigFile = "cabal-config"
checkDefaultConfigRelativePath :: FilePath
checkDefaultConfigRelativePath = ".." </> checkDefaultConfigFile
packageTestsConfigFile :: FilePath
packageTestsConfigFile = "cabal-config"
------------------------------------------------------------------------
-- * Running cabal commands
......
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