diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-06-18 00:46:05 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2019-06-19 01:12:33 +0200 |
commit | c3c7a2cff26ab6f2828bc53366c8bf54f9d0ec3c (patch) | |
tree | b86f3f97b61d8a3f6988dc9f8cb8be714e88d947 | |
parent | 127840e0a237e332b1f4ab88eb63a28f810b9b6b (diff) |
ghc-session: Simplify Cabal version checking
-rw-r--r-- | tests/GhcSession.hs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs index b555f47..6ec431a 100644 --- a/tests/GhcSession.hs +++ b/tests/GhcSession.hs @@ -171,22 +171,17 @@ checkAndRunTestConfig ps1@(psdImpl -> Ex psdImpl2) (TC test_loc min_cabal_ver min_ghc_ver _proj_types) = let - pt = psiProjType psdImpl2 + pt = demoteSProjType $ psiProjType psdImpl2 (topdir, projdir_rel, cabal_file) = testLocPath test_loc in do - ci_c_ver <- f_c_ver V1 - s_c_ver <- f_c_ver Stack + c_ver <- f_c_ver pt first SkipReason $ do - if| SStack <- pt, Left (SkipReason msg) <- stackCheckCompat s_ver g_ver -> - Left msg + if| Stack <- pt, Left (SkipReason msg) <- stackCheckCompat s_ver g_ver -> + Left $ msg | ci_ver < parseVer "1.24" -> Left $ "cabal-install-" ++ showVersion ci_ver ++ " is too old" - | ci_c_ver < min_cabal_ver -> - Left $ "cabal-install's builtin Cabal version is too old:\n" - ++ "Cabal-" ++ showVersion ci_c_ver - ++ " < " ++ showVersion min_cabal_ver - | s_c_ver < min_cabal_ver -> - Left $ "Stack's builtin Cabal version is too old:\n" - ++ "Cabal-" ++ showVersion s_c_ver + | c_ver < min_cabal_ver -> + Left $ pt_disp pt ++ "'s builtin Cabal version is too old:\n" + ++ "Cabal-" ++ showVersion c_ver ++ " < " ++ showVersion min_cabal_ver | g_ver < min_ghc_ver -> Left $ "ghc-" ++ showVersion g_ver @@ -201,6 +196,11 @@ checkAndRunTestConfig , "'" ++ topdir ++ "'" ]) (runTest ps1{ psdImpl = psdImpl2 } topdir projdir_rel cabal_file) + where + pt_disp V1 = "cabal-install" + pt_disp V2 = "cabal-install" + pt_disp Stack = "Stack" + runTest :: ProjSetup2 pt -> FilePath -> FilePath -> FilePath -> IO [Bool] runTest ps2@(psdImpl -> ProjSetupImpl{..}) topdir projdir cabal_file = do |