From efb4ce65962f555ee76533c1089b2c9ebdf4edb5 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sun, 14 Jan 2018 17:14:12 +0100 Subject: Refactor 'compileHelper' to cache helper in all cases --- tests/CompileTest.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/CompileTest.hs b/tests/CompileTest.hs index e65de8d..dbc033b 100644 --- a/tests/CompileTest.hs +++ b/tests/CompileTest.hs @@ -161,18 +161,21 @@ compilePrivatePkgDb eCabalVer = do res <- E.try $ installCabal defaultOptions { oVerbose = True } eCabalVer case res of Right (db, cabalVer) -> - compileWithPkg (Just db) cabalVer + compileWithPkg db cabalVer Left (ioe :: IOException) -> do print ioe return $ Left (ExitFailure 1) -compileWithPkg :: Maybe PackageDbDir +compileWithPkg :: PackageDbDir -> CabalVersion -> IO (Either ExitCode FilePath) -compileWithPkg mdb cabalVer = +compileWithPkg db cabalVer = do + appdir <- appCacheDir + let comp = + CompileWithCabalPackage (Just db) cabalVer [cabalPkgId cabalVer] CPSGlobal compile - (CompileWithCabalPackage mdb cabalVer [cabalPkgId cabalVer] CPSGlobal) - "/does-not-exist" + comp + (compPaths appdir (error "compile-test: distdir not available") comp) defaultOptions { oVerbose = True } -- cgit v1.2.3