aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-07-31 17:07:39 +0200
committerDaniel Gröber (dxld) <dxld@darkboxed.org>2019-09-17 17:48:26 +0200
commita93ed8c7d93df1860d2e56b400b724ac47edf470 (patch)
tree85360f0ca82a0e920ffd38b0aaa0318555d9b072 /tests
parent5ab34761ed8789286cd382273503129cc7a7134f (diff)
Merge CompPrograms back into Programs
We need to support passing down the path to ghc to new-build/stack in order to support using a non-default 'ghc' executable.
Diffstat (limited to 'tests')
-rw-r--r--tests/CompileTest.hs1
-rw-r--r--tests/GhcSession.hs21
2 files changed, 9 insertions, 13 deletions
diff --git a/tests/CompileTest.hs b/tests/CompileTest.hs
index 2df6c2d..1c76787 100644
--- a/tests/CompileTest.hs
+++ b/tests/CompileTest.hs
@@ -62,7 +62,6 @@ createHOME = do
main :: IO ()
main = do
let ?progs = defaultPrograms
- let ?cprogs = defaultCompPrograms
let ?opts = defaultCompileOptions { oVerbose = True }
let ?verbose = \level -> case level of 1 -> True; _ -> False
diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs
index a25c3f7..52eba4e 100644
--- a/tests/GhcSession.hs
+++ b/tests/GhcSession.hs
@@ -60,28 +60,28 @@ testConfigToTestSpec (TC loc _ _ _) pt =
let (topdir, projdir, cabal_file) = testLocPath loc in
"- " ++ intercalate ":" [topdir, projdir, cabal_file, show pt]
-type ModProgs = (Programs -> Programs, CompPrograms -> CompPrograms)
+type ModProgs = (Programs -> Programs)
options :: [OptDescr ModProgs]
options =
[ GetOpt.Option [] ["with-cabal"]
- (ReqArg (\arg -> (\p -> p { cabalProgram = arg }, id)) "PROG")
+ (ReqArg (\arg -> \p -> p { cabalProgram = arg }) "PROG")
"name or path of 'cabal' executable"
, GetOpt.Option [] ["with-stack"]
- (ReqArg (\arg -> (\p -> p { stackProgram = arg }, id)) "PROG")
+ (ReqArg (\arg -> \p -> p { stackProgram = arg }) "PROG")
"name or path of 'stack' executable"
, GetOpt.Option [] ["with-ghc"]
- (ReqArg (\arg -> (id, \cp -> cp { ghcProgram = arg })) "PROG")
+ (ReqArg (\arg -> \cp -> cp { ghcProgram = arg }) "PROG")
"name or path of 'ghc' executable"
, GetOpt.Option [] ["with-ghc-pkg"]
- (ReqArg (\arg -> (id, \cp -> cp { ghcPkgProgram = arg })) "PROG")
+ (ReqArg (\arg -> \cp -> cp { ghcPkgProgram = arg }) "PROG")
"name or path of 'ghc-pkg' executable"
]
testOpts :: [String] -> IO (ModProgs, [String])
testOpts args =
case getOpt Permute options args of
- (o,n,[] ) -> return (foldl (\(b, d) (a, c) -> (a . b, c . d)) (id, id) o, n)
+ (o,n,[] ) -> return (foldl (flip (.)) id o, n)
(_,_,errs) -> ioError (userError (concat errs ++ usageInfo header options))
where header = "Usage: ghc-session [OPTION..] [TEST_SPEC..]"
@@ -93,8 +93,7 @@ main = do
let withEnv :: (Env => a) -> a
withEnv action =
let ?verbose = const False
- ?progs = (fst modProgs) defaultPrograms
- ?cprogs = (snd modProgs) defaultCompPrograms
+ ?progs = modProgs defaultPrograms
in action
GhcVersion g_ver <- withEnv ghcVersion
@@ -317,10 +316,8 @@ test modProgs (psdImpl -> ProjSetupImpl{..}) topdir tmpdir projdir cabal_file
(psiProjLoc (CabalFile cabal_file) projdir)
(psiDistDir projdir)
- let qe = qe' { qePrograms = (fst modProgs) (qePrograms qe')
- , qeCompPrograms = (snd modProgs) (qeCompPrograms qe')
- }
- progs = qePrograms qe
+ let progs = modProgs (qePrograms qe')
+ qe = qe' { qePrograms = progs }
psiSdist progs topdir tmpdir
psiConfigure progs projdir